Data collection

## Using libcurl 8.3.0 with Schannel
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
## `geom_smooth()` using formula = 'y ~ x'

Location effects

Will run an ANOVA on the residuals with location and species as fixed effects. This will show me if morphology depends on the species, the location, and if the location and species interact to determine morphology. CANNOT DO WITH COUNT DATA–may have to run a glmer with zero-tuncated negative binomial/quasi-poisson distribution instead (think this will tell me if species, location, and interaction affect the trait…). Will only work with the residuals, because comparing the means of the residuals indicates differences in variation. Would I not just use Levene’s and MWU again but include spp and zone/basin/watershed?

Leaving the anovas for count data in rn until I figure out what to do.

I will first run this using the zones as the location factor. Zones (1-4) represent the latitude range with equivalent sample sizes in each, since the collections were not equally representative of all latitudes, and I wanted to avoid a sampling bias when randomly selecting samples. Zone 1 corresponds to the southern most latitude range, and zone 4 corresponds to the northern most latitude range.

I will then run the same analysis using basin as the location factor. Since fish are physically isolated to the river basins they occupy, the genetic variation is also limited to that basin. Thus it is possible for fish within the same basin to be more similar due to genetic/physical constraints. (will also do with watershed just to see).

Lastly I will run ANOVAs with both zones and basins but with standardized residuals. This would allow me to compare overall variation across traits (at least those that are depended on body size) rather than just one trait at a time. Not 100% sure if this is useful (or correct to do), but thought it would be interesting.

All data

ANOVAs

Amazon

Zones
library(ggplot2)

lat3 <- raw2[raw2$SPP == "p.latipinna", ]

form3 <- raw2[raw2$SPP == "p.latipinna", ]

A.D.F <- aov(abs.res.D ~ QUARTILE, data=form3)
summary(A.D.F)
##              Df Sum Sq Mean Sq F value  Pr(>F)   
## QUARTILE      3  2.306  0.7685   4.292 0.00635 **
## Residuals   130 23.277  0.1791                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(form3, aes(x=factor(QUARTILE), y=abs.res.D)) +
  geom_boxplot()

A.P1.F <- aov(abs.res.P1 ~ QUARTILE, data=form3)
summary(A.P1.F)
##              Df Sum Sq Mean Sq F value Pr(>F)
## QUARTILE      3  0.159 0.05296   0.444  0.722
## Residuals   130 15.511 0.11932
A.P1.R.F <- aov(abs.res.P1.R ~ QUARTILE, data=form3)
summary(A.P1.R.F)
##              Df Sum Sq Mean Sq F value Pr(>F)
## QUARTILE      3  0.065 0.02172   0.166  0.919
## Residuals   130 16.987 0.13067
ggplot(form3, aes(x=factor(QUARTILE), y=abs.res.P1.R)) +
  geom_boxplot()

A.LLSC.F <- aov(abs.res.LLSC ~ QUARTILE, data=form3)
summary(A.LLSC.F)
##              Df Sum Sq Mean Sq F value Pr(>F)
## QUARTILE      3   1.31  0.4354   1.209  0.309
## Residuals   130  46.80  0.3600
A.SBLL.F <- aov(abs.res.SBLL ~ QUARTILE, data=form3)
summary(A.SBLL.F)
##              Df Sum Sq Mean Sq F value Pr(>F)
## QUARTILE      3  0.436  0.1454   1.142  0.335
## Residuals   130 16.546  0.1273
ggplot(form3, aes(x=factor(QUARTILE), y=abs.res.SBLL)) +
  geom_boxplot()

A.BD.F <- aov(abs.res.BD ~ QUARTILE, data=form3)
summary(A.BD.F)
##              Df  Sum Sq  Mean Sq F value Pr(>F)
## QUARTILE      3 0.00594 0.001981   1.519  0.213
## Residuals   130 0.16955 0.001304
ggplot(form3, aes(x=factor(QUARTILE), y=abs.res.BD)) +
  geom_boxplot()

A.CPD.F <- aov(abs.res.CPD ~ QUARTILE, data=form3)
summary(A.CPD.F)
##              Df  Sum Sq  Mean Sq F value  Pr(>F)    
## QUARTILE      3 0.01249 0.004163   6.832 0.00026 ***
## Residuals   130 0.07922 0.000609                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(form3, aes(x=factor(QUARTILE), y=abs.res.CPD)) +
  geom_boxplot()

A.CPL.F <- aov(abs.res.CPL ~ QUARTILE, data=form3)
summary(A.CPL.F)
##              Df  Sum Sq  Mean Sq F value   Pr(>F)    
## QUARTILE      3 0.02074 0.006912   9.448 1.08e-05 ***
## Residuals   130 0.09511 0.000732                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(form3, aes(x=factor(QUARTILE), y=abs.res.CPL)) +
  geom_boxplot()

A.PreDL.F <- aov(abs.res.PreDL ~ QUARTILE, data=form3)
summary(A.PreDL.F)
##              Df  Sum Sq   Mean Sq F value Pr(>F)
## QUARTILE      3 0.00209 0.0006977   1.606  0.191
## Residuals   130 0.05646 0.0004343
ggplot(form3, aes(x=factor(QUARTILE), y=abs.res.PreDL)) +
  geom_boxplot()

A.DbL.F <- aov(abs.res.DbL ~ QUARTILE, data=form3)
summary(A.DbL.F)
##              Df  Sum Sq  Mean Sq F value Pr(>F)  
## QUARTILE      3 0.01219 0.004063   2.276 0.0828 .
## Residuals   130 0.23204 0.001785                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(form3, aes(x=factor(QUARTILE), y=abs.res.DbL)) +
  geom_boxplot()

A.HL.F <- aov(abs.res.HL ~ QUARTILE, data=form3)
summary(A.HL.F)
##              Df  Sum Sq   Mean Sq F value Pr(>F)
## QUARTILE      3 0.00344 0.0011466   1.324  0.269
## Residuals   130 0.11260 0.0008661
ggplot(form3, aes(x=factor(QUARTILE), y=abs.res.HL)) +
  geom_boxplot()

A.HD.F <- aov(abs.res.HD ~ QUARTILE, data=form3)
summary(A.HD.F)
##              Df  Sum Sq  Mean Sq F value Pr(>F)
## QUARTILE      3 0.00672 0.002239    2.04  0.111
## Residuals   130 0.14269 0.001098
A.HW.F <- aov(abs.res.HW ~ QUARTILE, data=form3)
summary(A.HW.F)
##              Df  Sum Sq  Mean Sq F value   Pr(>F)    
## QUARTILE      3 0.01136 0.003788   7.212 0.000163 ***
## Residuals   130 0.06827 0.000525                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(form3, aes(x=factor(QUARTILE), y=abs.res.HW)) +
  geom_boxplot()

A.SnL.F <- aov(abs.res.SnL ~ QUARTILE, data=form3)
summary(A.SnL.F)
##              Df  Sum Sq   Mean Sq F value  Pr(>F)   
## QUARTILE      3 0.00766 0.0025545   5.052 0.00242 **
## Residuals   130 0.06573 0.0005056                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
A.OL.F <- aov(abs.res.OL ~ QUARTILE, data=form3)
summary(A.OL.F)
##              Df   Sum Sq   Mean Sq F value Pr(>F)
## QUARTILE      3 2.17e-32 7.242e-33   1.538  0.208
## Residuals   130 6.12e-31 4.708e-33
ggplot(form3, aes(x=factor(QUARTILE), y=abs.res.OL)) +
  geom_boxplot()

Basins
A1.D.F <- aov(abs.res.D ~ BASIN, data=form3)
summary(A1.D.F)
##              Df Sum Sq Mean Sq F value Pr(>F)  
## BASIN         5  2.789  0.5579   3.133 0.0106 *
## Residuals   128 22.793  0.1781                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(form3, aes(x=factor(BASIN), y=abs.res.D)) +
  geom_boxplot()

A1.P1.F <- aov(abs.res.P1 ~ BASIN, data=form3)
summary(A1.P1.F)
##              Df Sum Sq Mean Sq F value Pr(>F)
## BASIN         5  0.945  0.1891   1.643  0.153
## Residuals   128 14.725  0.1150
A1.P1.R.F <- aov(abs.res.P1.R ~ BASIN, data=form3)
summary(A1.P1.R.F)
##              Df Sum Sq Mean Sq F value Pr(>F)
## BASIN         5  0.159 0.03187   0.241  0.943
## Residuals   128 16.893 0.13197
ggplot(form3, aes(x=factor(BASIN), y=abs.res.P1.R)) +
  geom_boxplot()

A1.LLSC.F <- aov(abs.res.LLSC ~ BASIN, data=form3)
summary(A1.LLSC.F)
##              Df Sum Sq Mean Sq F value Pr(>F)  
## BASIN         5   4.54  0.9080   2.668  0.025 *
## Residuals   128  43.57  0.3404                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(form3, aes(x=factor(BASIN), y=abs.res.LLSC)) +
  geom_boxplot()

A1.SBLL.F <- aov(abs.res.SBLL ~ BASIN, data=form3)
summary(A1.SBLL.F)
##              Df Sum Sq Mean Sq F value Pr(>F)
## BASIN         5  0.755  0.1510   1.191  0.317
## Residuals   128 16.228  0.1268
ggplot(form3, aes(x=factor(BASIN), y=abs.res.SBLL)) +
  geom_boxplot()

A1.BD.F <- aov(abs.res.BD ~ BASIN, data=form3)
summary(A1.BD.F)
##              Df  Sum Sq  Mean Sq F value Pr(>F)
## BASIN         5 0.00786 0.001571     1.2  0.313
## Residuals   128 0.16764 0.001310
ggplot(form3, aes(x=factor(BASIN), y=abs.res.BD)) +
  geom_boxplot()

A1.CPD.F <- aov(abs.res.CPD ~ BASIN, data=form3)
summary(A1.CPD.F)
##              Df  Sum Sq  Mean Sq F value   Pr(>F)    
## BASIN         5 0.01713 0.003425   5.879 6.34e-05 ***
## Residuals   128 0.07458 0.000583                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(form3, aes(x=factor(BASIN), y=abs.res.CPD)) +
  geom_boxplot()

A1.CPL.F <- aov(abs.res.CPL ~ BASIN, data=form3)
summary(A1.CPL.F)
##              Df  Sum Sq  Mean Sq F value   Pr(>F)    
## BASIN         5 0.02013 0.004025   5.383 0.000159 ***
## Residuals   128 0.09572 0.000748                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
A1.PreDL.F <- aov(abs.res.PreDL ~ BASIN, data=form3)
summary(A1.PreDL.F)
##              Df  Sum Sq   Mean Sq F value Pr(>F)  
## BASIN         5 0.00492 0.0009846    2.35 0.0445 *
## Residuals   128 0.05363 0.0004190                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(form3, aes(x=factor(BASIN), y=abs.res.PreDL)) +
  geom_boxplot()

A1.DbL.F <- aov(abs.res.DbL ~ BASIN, data=form3)
summary(A1.DbL.F)
##              Df  Sum Sq  Mean Sq F value Pr(>F)
## BASIN         5 0.00996 0.001992   1.088   0.37
## Residuals   128 0.23428 0.001830
ggplot(form3, aes(x=factor(BASIN), y=abs.res.DbL)) +
  geom_boxplot()

A1.HL.F <- aov(abs.res.HL ~ BASIN, data=form3)
summary(A1.HL.F)
##              Df  Sum Sq   Mean Sq F value Pr(>F)
## BASIN         5 0.00766 0.0015321   1.809  0.115
## Residuals   128 0.10838 0.0008467
ggplot(form3, aes(x=factor(BASIN), y=abs.res.HL)) +
  geom_boxplot()

A1.HD.F <- aov(abs.res.HD ~ BASIN, data=form3)
summary(A1.HD.F)
##              Df  Sum Sq  Mean Sq F value Pr(>F)
## BASIN         5 0.00684 0.001367   1.228    0.3
## Residuals   128 0.14257 0.001114
ggplot(form3, aes(x=factor(BASIN), y=abs.res.HD)) +
  geom_boxplot()

A1.HW.F <- aov(abs.res.HW ~ BASIN, data=form3)
summary(A1.HW.F)
##              Df  Sum Sq   Mean Sq F value   Pr(>F)    
## BASIN         5 0.01460 0.0029194   5.746 8.11e-05 ***
## Residuals   128 0.06504 0.0005081                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(form3, aes(x=factor(BASIN), y=abs.res.HW)) +
  geom_boxplot()

A1.SnL.F <- aov(abs.res.SnL ~ BASIN, data=form3)
summary(A1.SnL.F)
##              Df  Sum Sq  Mean Sq F value   Pr(>F)    
## BASIN         5 0.01931 0.003861   9.138 1.87e-07 ***
## Residuals   128 0.05409 0.000423                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
A1.OL.F <- aov(abs.res.OL ~ BASIN, data=form3)
summary(A1.OL.F)
##              Df    Sum Sq   Mean Sq F value Pr(>F)
## BASIN         5 1.240e-32 2.479e-33   0.511  0.768
## Residuals   128 6.214e-31 4.854e-33
ggplot(form3, aes(x=factor(BASIN), y=abs.res.OL)) +
  geom_boxplot()

Watersheds
A2.D.F <- aov(abs.res.D ~ WATERSHED, data=form3)
summary(A2.D.F)
##              Df Sum Sq Mean Sq F value Pr(>F)  
## WATERSHED    11  3.847  0.3497   1.963 0.0378 *
## Residuals   122 21.736  0.1782                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(form3, aes(x=factor(WATERSHED), y=abs.res.D)) +
  geom_boxplot()

A2.P1.F <- aov(abs.res.P1 ~ WATERSHED, data=form3)
summary(A2.P1.F)
##              Df Sum Sq Mean Sq F value Pr(>F)
## WATERSHED    11  1.302  0.1184   1.005  0.446
## Residuals   122 14.368  0.1178
A2.P1.R.F <- aov(abs.res.P1.R ~ WATERSHED, data=form3)
summary(A2.P1.R.F)
##              Df Sum Sq Mean Sq F value Pr(>F)
## WATERSHED    11   0.34 0.03093   0.226  0.995
## Residuals   122  16.71 0.13698
ggplot(form3, aes(x=factor(WATERSHED), y=abs.res.P1.R)) +
  geom_boxplot()

A2.LLSC.F <- aov(abs.res.LLSC ~ WATERSHED, data=form3)
summary(A2.LLSC.F)
##              Df Sum Sq Mean Sq F value Pr(>F)  
## WATERSHED    11   8.16  0.7422   2.267  0.015 *
## Residuals   122  39.94  0.3274                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(form3, aes(x=factor(WATERSHED), y=abs.res.LLSC)) +
  geom_boxplot()

A2.SBLL.F <- aov(abs.res.SBLL ~ WATERSHED, data=form3)
summary(A2.SBLL.F)
##              Df Sum Sq Mean Sq F value   Pr(>F)    
## WATERSHED    11  5.086  0.4623   4.741 4.93e-06 ***
## Residuals   122 11.897  0.0975                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(form3, aes(x=factor(WATERSHED), y=abs.res.SBLL)) +
  geom_boxplot()

A2.BD.F <- aov(abs.res.BD ~ WATERSHED, data=form3)
summary(A2.BD.F)
##              Df  Sum Sq  Mean Sq F value Pr(>F)
## WATERSHED    11 0.01278 0.001162   0.871  0.571
## Residuals   122 0.16271 0.001334
ggplot(form3, aes(x=factor(WATERSHED), y=abs.res.BD)) +
  geom_boxplot()

A2.CPD.F <- aov(abs.res.CPD ~ WATERSHED, data=form3)
summary(A2.CPD.F)
##              Df  Sum Sq   Mean Sq F value  Pr(>F)   
## WATERSHED    11 0.01833 0.0016662    2.77 0.00304 **
## Residuals   122 0.07338 0.0006015                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(form3, aes(x=factor(WATERSHED), y=abs.res.CPD)) +
  geom_boxplot()

A2.CPL.F <- aov(abs.res.CPL ~ WATERSHED, data=form3)
summary(A2.CPL.F)
##              Df  Sum Sq   Mean Sq F value   Pr(>F)    
## WATERSHED    11 0.03237 0.0029429   4.301 2.05e-05 ***
## Residuals   122 0.08347 0.0006842                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
A2.PreDL.F <- aov(abs.res.PreDL ~ WATERSHED, data=form3)
summary(A2.PreDL.F)
##              Df  Sum Sq   Mean Sq F value Pr(>F)
## WATERSHED    11 0.00568 0.0005163   1.191    0.3
## Residuals   122 0.05288 0.0004334
A2.DbL.F <- aov(abs.res.DbL ~ WATERSHED, data=form3)
summary(A2.DbL.F)
##              Df  Sum Sq  Mean Sq F value Pr(>F)  
## WATERSHED    11 0.04272 0.003883   2.351 0.0115 *
## Residuals   122 0.20152 0.001652                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(form3, aes(x=factor(WATERSHED), y=abs.res.DbL)) +
  geom_boxplot()

A2.HL.F <- aov(abs.res.HL ~ WATERSHED, data=form3)
summary(A2.HL.F)
##              Df  Sum Sq   Mean Sq F value Pr(>F)
## WATERSHED    11 0.01169 0.0010627   1.243  0.267
## Residuals   122 0.10435 0.0008553
ggplot(form3, aes(x=factor(WATERSHED), y=abs.res.HL)) +
  geom_boxplot()

A2.HD.F <- aov(abs.res.HD ~ WATERSHED, data=form3)
summary(A2.HD.F)
##              Df  Sum Sq   Mean Sq F value Pr(>F)
## WATERSHED    11 0.01036 0.0009418   0.826  0.614
## Residuals   122 0.13905 0.0011397
ggplot(form3, aes(x=factor(WATERSHED), y=abs.res.HD)) +
  geom_boxplot()

A2.HW.F <- aov(abs.res.HW ~ WATERSHED, data=form3)
summary(A2.HW.F)
##              Df  Sum Sq   Mean Sq F value  Pr(>F)   
## WATERSHED    11 0.01704 0.0015488   3.018 0.00136 **
## Residuals   122 0.06260 0.0005131                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(form3, aes(x=factor(WATERSHED), y=abs.res.HW)) +
  geom_boxplot()

A2.SnL.F <- aov(abs.res.SnL ~ WATERSHED, data=form3)
summary(A2.SnL.F)
##              Df  Sum Sq   Mean Sq F value   Pr(>F)    
## WATERSHED    11 0.02208 0.0020073   4.772 4.46e-06 ***
## Residuals   122 0.05131 0.0004206                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
A2.OL.F <- aov(abs.res.OL ~ WATERSHED, data=form3)
summary(A2.OL.F)
##              Df    Sum Sq   Mean Sq F value Pr(>F)
## WATERSHED    11 2.610e-32 2.372e-33   0.476  0.915
## Residuals   122 6.077e-31 4.981e-33
ggplot(form3, aes(x=factor(WATERSHED), y=abs.res.OL)) +
  geom_boxplot()

Sailfin

Zones
library(ggplot2)

A.D.L <- aov(abs.res.D ~ QUARTILE, data=lat3)
summary(A.D.L)
##              Df Sum Sq Mean Sq F value  Pr(>F)   
## QUARTILE      3  2.306  0.7685   4.292 0.00635 **
## Residuals   130 23.277  0.1791                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(lat3, aes(x=factor(QUARTILE), y=abs.res.D)) +
  geom_boxplot()

A.P1.L <- aov(abs.res.P1 ~ QUARTILE, data=lat3)
summary(A.P1.L)
##              Df Sum Sq Mean Sq F value Pr(>F)
## QUARTILE      3  0.159 0.05296   0.444  0.722
## Residuals   130 15.511 0.11932
A.P1.R.L <- aov(abs.res.P1.R ~ QUARTILE, data=lat3)
summary(A.P1.R.L)
##              Df Sum Sq Mean Sq F value Pr(>F)
## QUARTILE      3  0.065 0.02172   0.166  0.919
## Residuals   130 16.987 0.13067
ggplot(lat3, aes(x=factor(QUARTILE), y=abs.res.P1.R)) +
  geom_boxplot()

A.LLSC.L <- aov(abs.res.LLSC ~ QUARTILE, data=lat3)
summary(A.LLSC.L)
##              Df Sum Sq Mean Sq F value Pr(>F)
## QUARTILE      3   1.31  0.4354   1.209  0.309
## Residuals   130  46.80  0.3600
A.SBLL.L <- aov(abs.res.SBLL ~ QUARTILE, data=lat3)
summary(A.SBLL.L)
##              Df Sum Sq Mean Sq F value Pr(>F)
## QUARTILE      3  0.436  0.1454   1.142  0.335
## Residuals   130 16.546  0.1273
ggplot(lat3, aes(x=factor(QUARTILE), y=abs.res.SBLL)) +
  geom_boxplot()

A.BD.L <- aov(abs.res.BD ~ QUARTILE, data=lat3)
summary(A.BD.L)
##              Df  Sum Sq  Mean Sq F value Pr(>F)
## QUARTILE      3 0.00594 0.001981   1.519  0.213
## Residuals   130 0.16955 0.001304
ggplot(lat3, aes(x=factor(QUARTILE), y=abs.res.BD)) +
  geom_boxplot()

A.CPD.L <- aov(abs.res.CPD ~ QUARTILE, data=lat3)
summary(A.CPD.L)
##              Df  Sum Sq  Mean Sq F value  Pr(>F)    
## QUARTILE      3 0.01249 0.004163   6.832 0.00026 ***
## Residuals   130 0.07922 0.000609                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(lat3, aes(x=factor(QUARTILE), y=abs.res.CPD)) +
  geom_boxplot()

A.CPL.L <- aov(abs.res.CPL ~ QUARTILE, data=lat3)
summary(A.CPL.L)
##              Df  Sum Sq  Mean Sq F value   Pr(>F)    
## QUARTILE      3 0.02074 0.006912   9.448 1.08e-05 ***
## Residuals   130 0.09511 0.000732                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(lat3, aes(x=factor(QUARTILE), y=abs.res.CPL)) +
  geom_boxplot()

A.PreDL.L <- aov(abs.res.PreDL ~ QUARTILE, data=lat3)
summary(A.PreDL.L)
##              Df  Sum Sq   Mean Sq F value Pr(>F)
## QUARTILE      3 0.00209 0.0006977   1.606  0.191
## Residuals   130 0.05646 0.0004343
ggplot(lat3, aes(x=factor(QUARTILE), y=abs.res.PreDL)) +
  geom_boxplot()

A.DbL.L <- aov(abs.res.DbL ~ QUARTILE, data=lat3)
summary(A.DbL.L)
##              Df  Sum Sq  Mean Sq F value Pr(>F)  
## QUARTILE      3 0.01219 0.004063   2.276 0.0828 .
## Residuals   130 0.23204 0.001785                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(lat3, aes(x=factor(QUARTILE), y=abs.res.DbL)) +
  geom_boxplot()

A.HL.L <- aov(abs.res.HL ~ QUARTILE, data=lat3)
summary(A.HL.L)
##              Df  Sum Sq   Mean Sq F value Pr(>F)
## QUARTILE      3 0.00344 0.0011466   1.324  0.269
## Residuals   130 0.11260 0.0008661
ggplot(lat3, aes(x=factor(QUARTILE), y=abs.res.HL)) +
  geom_boxplot()

A.HD.L <- aov(abs.res.HD ~ QUARTILE, data=lat3)
summary(A.HD.L)
##              Df  Sum Sq  Mean Sq F value Pr(>F)
## QUARTILE      3 0.00672 0.002239    2.04  0.111
## Residuals   130 0.14269 0.001098
A.HW.L <- aov(abs.res.HW ~ QUARTILE, data=lat3)
summary(A.HW.L)
##              Df  Sum Sq  Mean Sq F value   Pr(>F)    
## QUARTILE      3 0.01136 0.003788   7.212 0.000163 ***
## Residuals   130 0.06827 0.000525                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(lat3, aes(x=factor(QUARTILE), y=abs.res.HW)) +
  geom_boxplot()

A.SnL.L <- aov(abs.res.SnL ~ QUARTILE, data=lat3)
summary(A.SnL.L)
##              Df  Sum Sq   Mean Sq F value  Pr(>F)   
## QUARTILE      3 0.00766 0.0025545   5.052 0.00242 **
## Residuals   130 0.06573 0.0005056                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
A.OL.L <- aov(abs.res.OL ~ QUARTILE, data=lat3)
summary(A.OL.L)
##              Df   Sum Sq   Mean Sq F value Pr(>F)
## QUARTILE      3 2.17e-32 7.242e-33   1.538  0.208
## Residuals   130 6.12e-31 4.708e-33
ggplot(lat3, aes(x=factor(QUARTILE), y=abs.res.OL)) +
  geom_boxplot()

Basins
A1.D.L <- aov(abs.res.D ~ BASIN, data=lat3)
summary(A1.D.L)
##              Df Sum Sq Mean Sq F value Pr(>F)  
## BASIN         5  2.789  0.5579   3.133 0.0106 *
## Residuals   128 22.793  0.1781                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(lat3, aes(x=factor(BASIN), y=abs.res.D)) +
  geom_boxplot()

A1.P1.L <- aov(abs.res.P1 ~ BASIN, data=lat3)
summary(A1.P1.L)
##              Df Sum Sq Mean Sq F value Pr(>F)
## BASIN         5  0.945  0.1891   1.643  0.153
## Residuals   128 14.725  0.1150
A1.P1.R.L <- aov(abs.res.P1.R ~ BASIN, data=lat3)
summary(A1.P1.R.L)
##              Df Sum Sq Mean Sq F value Pr(>F)
## BASIN         5  0.159 0.03187   0.241  0.943
## Residuals   128 16.893 0.13197
ggplot(lat3, aes(x=factor(BASIN), y=abs.res.P1.R)) +
  geom_boxplot()

A1.LLSC.L <- aov(abs.res.LLSC ~ BASIN, data=lat3)
summary(A1.LLSC.L)
##              Df Sum Sq Mean Sq F value Pr(>F)  
## BASIN         5   4.54  0.9080   2.668  0.025 *
## Residuals   128  43.57  0.3404                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(lat3, aes(x=factor(BASIN), y=abs.res.LLSC)) +
  geom_boxplot()

A1.SBLL.L <- aov(abs.res.SBLL ~ BASIN, data=lat3)
summary(A1.SBLL.L)
##              Df Sum Sq Mean Sq F value Pr(>F)
## BASIN         5  0.755  0.1510   1.191  0.317
## Residuals   128 16.228  0.1268
ggplot(lat3, aes(x=factor(BASIN), y=abs.res.SBLL)) +
  geom_boxplot()

A1.BD.L <- aov(abs.res.BD ~ BASIN, data=lat3)
summary(A1.BD.L)
##              Df  Sum Sq  Mean Sq F value Pr(>F)
## BASIN         5 0.00786 0.001571     1.2  0.313
## Residuals   128 0.16764 0.001310
ggplot(lat3, aes(x=factor(BASIN), y=abs.res.BD)) +
  geom_boxplot()

A1.CPD.L <- aov(abs.res.CPD ~ BASIN, data=lat3)
summary(A1.CPD.L)
##              Df  Sum Sq  Mean Sq F value   Pr(>F)    
## BASIN         5 0.01713 0.003425   5.879 6.34e-05 ***
## Residuals   128 0.07458 0.000583                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(lat3, aes(x=factor(BASIN), y=abs.res.CPD)) +
  geom_boxplot()

A1.CPL.L <- aov(abs.res.CPL ~ BASIN, data=lat3)
summary(A1.CPL.L)
##              Df  Sum Sq  Mean Sq F value   Pr(>F)    
## BASIN         5 0.02013 0.004025   5.383 0.000159 ***
## Residuals   128 0.09572 0.000748                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
A1.PreDL.L <- aov(abs.res.PreDL ~ BASIN, data=lat3)
summary(A1.PreDL.L)
##              Df  Sum Sq   Mean Sq F value Pr(>F)  
## BASIN         5 0.00492 0.0009846    2.35 0.0445 *
## Residuals   128 0.05363 0.0004190                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(lat3, aes(x=factor(BASIN), y=abs.res.PreDL)) +
  geom_boxplot()

A1.DbL.L <- aov(abs.res.DbL ~ BASIN, data=lat3)
summary(A1.DbL.L)
##              Df  Sum Sq  Mean Sq F value Pr(>F)
## BASIN         5 0.00996 0.001992   1.088   0.37
## Residuals   128 0.23428 0.001830
ggplot(lat3, aes(x=factor(BASIN), y=abs.res.DbL)) +
  geom_boxplot()

A1.HL.L <- aov(abs.res.HL ~ BASIN, data=lat3)
summary(A1.HL.L)
##              Df  Sum Sq   Mean Sq F value Pr(>F)
## BASIN         5 0.00766 0.0015321   1.809  0.115
## Residuals   128 0.10838 0.0008467
ggplot(lat3, aes(x=factor(BASIN), y=abs.res.HL)) +
  geom_boxplot()

A1.HD.L <- aov(abs.res.HD ~ BASIN, data=lat3)
summary(A1.HD.L)
##              Df  Sum Sq  Mean Sq F value Pr(>F)
## BASIN         5 0.00684 0.001367   1.228    0.3
## Residuals   128 0.14257 0.001114
ggplot(lat3, aes(x=factor(BASIN), y=abs.res.HD)) +
  geom_boxplot()

A1.HW.L <- aov(abs.res.HW ~ BASIN, data=lat3)
summary(A1.HW.L)
##              Df  Sum Sq   Mean Sq F value   Pr(>F)    
## BASIN         5 0.01460 0.0029194   5.746 8.11e-05 ***
## Residuals   128 0.06504 0.0005081                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(lat3, aes(x=factor(BASIN), y=abs.res.HW)) +
  geom_boxplot()

A1.SnL.L <- aov(abs.res.SnL ~ BASIN, data=lat3)
summary(A1.SnL.L)
##              Df  Sum Sq  Mean Sq F value   Pr(>F)    
## BASIN         5 0.01931 0.003861   9.138 1.87e-07 ***
## Residuals   128 0.05409 0.000423                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
A1.OL.L <- aov(abs.res.OL ~ BASIN, data=lat3)
summary(A1.OL.L)
##              Df    Sum Sq   Mean Sq F value Pr(>F)
## BASIN         5 1.240e-32 2.479e-33   0.511  0.768
## Residuals   128 6.214e-31 4.854e-33
ggplot(lat3, aes(x=factor(BASIN), y=abs.res.OL)) +
  geom_boxplot()

Watersheds
A2.D.L <- aov(abs.res.D ~ WATERSHED, data=lat3)
summary(A2.D.L)
##              Df Sum Sq Mean Sq F value Pr(>F)  
## WATERSHED    11  3.847  0.3497   1.963 0.0378 *
## Residuals   122 21.736  0.1782                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(lat3, aes(x=factor(WATERSHED), y=abs.res.D)) +
  geom_boxplot()

A2.P1.L <- aov(abs.res.P1 ~ WATERSHED, data=lat3)
summary(A2.P1.L)
##              Df Sum Sq Mean Sq F value Pr(>F)
## WATERSHED    11  1.302  0.1184   1.005  0.446
## Residuals   122 14.368  0.1178
A2.P1.R.L <- aov(abs.res.P1.R ~ WATERSHED, data=lat3)
summary(A2.P1.R.L)
##              Df Sum Sq Mean Sq F value Pr(>F)
## WATERSHED    11   0.34 0.03093   0.226  0.995
## Residuals   122  16.71 0.13698
ggplot(lat3, aes(x=factor(WATERSHED), y=abs.res.P1.R)) +
  geom_boxplot()

A2.LLSC.L <- aov(abs.res.LLSC ~ WATERSHED, data=lat3)
summary(A2.LLSC.L)
##              Df Sum Sq Mean Sq F value Pr(>F)  
## WATERSHED    11   8.16  0.7422   2.267  0.015 *
## Residuals   122  39.94  0.3274                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(lat3, aes(x=factor(WATERSHED), y=abs.res.LLSC)) +
  geom_boxplot()

A2.SBLL.L <- aov(abs.res.SBLL ~ WATERSHED, data=lat3)
summary(A2.SBLL.L)
##              Df Sum Sq Mean Sq F value   Pr(>F)    
## WATERSHED    11  5.086  0.4623   4.741 4.93e-06 ***
## Residuals   122 11.897  0.0975                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(lat3, aes(x=factor(WATERSHED), y=abs.res.SBLL)) +
  geom_boxplot()

A2.BD.L <- aov(abs.res.BD ~ WATERSHED, data=lat3)
summary(A2.BD.L)
##              Df  Sum Sq  Mean Sq F value Pr(>F)
## WATERSHED    11 0.01278 0.001162   0.871  0.571
## Residuals   122 0.16271 0.001334
ggplot(lat3, aes(x=factor(WATERSHED), y=abs.res.BD)) +
  geom_boxplot()

A2.CPD.L <- aov(abs.res.CPD ~ WATERSHED, data=lat3)
summary(A2.CPD.L)
##              Df  Sum Sq   Mean Sq F value  Pr(>F)   
## WATERSHED    11 0.01833 0.0016662    2.77 0.00304 **
## Residuals   122 0.07338 0.0006015                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(lat3, aes(x=factor(WATERSHED), y=abs.res.CPD)) +
  geom_boxplot()

A2.CPL.L <- aov(abs.res.CPL ~ WATERSHED, data=lat3)
summary(A2.CPL.L)
##              Df  Sum Sq   Mean Sq F value   Pr(>F)    
## WATERSHED    11 0.03237 0.0029429   4.301 2.05e-05 ***
## Residuals   122 0.08347 0.0006842                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
A2.PreDL.L <- aov(abs.res.PreDL ~ WATERSHED, data=lat3)
summary(A2.PreDL.L)
##              Df  Sum Sq   Mean Sq F value Pr(>F)
## WATERSHED    11 0.00568 0.0005163   1.191    0.3
## Residuals   122 0.05288 0.0004334
A2.DbL.L <- aov(abs.res.DbL ~ WATERSHED, data=lat3)
summary(A2.DbL.L)
##              Df  Sum Sq  Mean Sq F value Pr(>F)  
## WATERSHED    11 0.04272 0.003883   2.351 0.0115 *
## Residuals   122 0.20152 0.001652                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(lat3, aes(x=factor(WATERSHED), y=abs.res.DbL)) +
  geom_boxplot()

A2.HL.L <- aov(abs.res.HL ~ WATERSHED, data=lat3)
summary(A2.HL.L)
##              Df  Sum Sq   Mean Sq F value Pr(>F)
## WATERSHED    11 0.01169 0.0010627   1.243  0.267
## Residuals   122 0.10435 0.0008553
ggplot(lat3, aes(x=factor(WATERSHED), y=abs.res.HL)) +
  geom_boxplot()

A2.HD.L <- aov(abs.res.HD ~ WATERSHED, data=lat3)
summary(A2.HD.L)
##              Df  Sum Sq   Mean Sq F value Pr(>F)
## WATERSHED    11 0.01036 0.0009418   0.826  0.614
## Residuals   122 0.13905 0.0011397
ggplot(lat3, aes(x=factor(WATERSHED), y=abs.res.HD)) +
  geom_boxplot()

A2.HW.L <- aov(abs.res.HW ~ WATERSHED, data=lat3)
summary(A2.HW.L)
##              Df  Sum Sq   Mean Sq F value  Pr(>F)   
## WATERSHED    11 0.01704 0.0015488   3.018 0.00136 **
## Residuals   122 0.06260 0.0005131                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(lat3, aes(x=factor(WATERSHED), y=abs.res.HW)) +
  geom_boxplot()

A2.SnL.L <- aov(abs.res.SnL ~ WATERSHED, data=lat3)
summary(A2.SnL.L)
##              Df  Sum Sq   Mean Sq F value   Pr(>F)    
## WATERSHED    11 0.02208 0.0020073   4.772 4.46e-06 ***
## Residuals   122 0.05131 0.0004206                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
A2.OL.L <- aov(abs.res.OL ~ WATERSHED, data=lat3)
summary(A2.OL.L)
##              Df    Sum Sq   Mean Sq F value Pr(>F)
## WATERSHED    11 2.610e-32 2.372e-33   0.476  0.915
## Residuals   122 6.077e-31 4.981e-33
ggplot(lat3, aes(x=factor(WATERSHED), y=abs.res.OL)) +
  geom_boxplot()

Both

Zones
library(ggplot2)

A.D <- aov(abs.res.D ~ SPP*QUARTILE, data=raw3)
summary(A.D)
##               Df Sum Sq Mean Sq F value  Pr(>F)    
## SPP            1   0.06  0.0635   0.408 0.52344    
## QUARTILE       3   0.45  0.1510   0.970 0.40715    
## SPP:QUARTILE   3   3.22  1.0719   6.888 0.00017 ***
## Residuals    292  45.44  0.1556                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(raw3, aes(x=factor(QUARTILE), y=abs.res.D, fill=SPP)) +
  geom_boxplot()

A.P1.L <- aov(abs.res.P1 ~ SPP*QUARTILE, data=raw3)
summary(A.P1.L)
##               Df Sum Sq Mean Sq F value Pr(>F)
## SPP            1   0.29  0.2878   1.554  0.214
## QUARTILE       3   1.10  0.3663   1.977  0.117
## SPP:QUARTILE   3   0.73  0.2427   1.310  0.271
## Residuals    292  54.10  0.1853
A.P1.R <- aov(abs.res.P1.R ~ SPP*QUARTILE, data=raw3)
summary(A.P1.R)
##               Df Sum Sq Mean Sq F value   Pr(>F)    
## SPP            1   1.80  1.7983  11.423 0.000824 ***
## QUARTILE       3   0.13  0.0434   0.276 0.842918    
## SPP:QUARTILE   3   0.06  0.0189   0.120 0.948162    
## Residuals    292  45.97  0.1574                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(raw3, aes(x=factor(QUARTILE), y=abs.res.P1.R, fill=SPP)) +
  geom_boxplot()

A.LLSC <- aov(abs.res.LLSC ~ SPP*QUARTILE, data=raw3)
summary(A.LLSC)
##               Df Sum Sq Mean Sq F value Pr(>F)  
## SPP            1   1.40  1.4013   2.940 0.0875 .
## QUARTILE       3   1.35  0.4506   0.945 0.4190  
## SPP:QUARTILE   3   3.42  1.1399   2.391 0.0688 .
## Residuals    292 139.19  0.4767                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
A.SBLL <- aov(abs.res.SBLL ~ SPP*QUARTILE, data=raw3)
summary(A.SBLL)
##               Df Sum Sq Mean Sq F value Pr(>F)  
## SPP            1   0.65  0.6523   4.859 0.0283 *
## QUARTILE       3   0.78  0.2591   1.930 0.1248  
## SPP:QUARTILE   3   0.12  0.0390   0.291 0.8320  
## Residuals    292  39.20  0.1342                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(raw3, aes(x=factor(QUARTILE), y=abs.res.SBLL, fill=SPP)) +
  geom_boxplot()

A.BD <- aov(abs.res.BD ~ SPP*QUARTILE, data=raw3)
summary(A.BD)
##               Df Sum Sq   Mean Sq F value Pr(>F)  
## SPP            1 0.0000 0.0000346   0.026 0.8726  
## QUARTILE       3 0.0015 0.0004855   0.361 0.7811  
## SPP:QUARTILE   3 0.0087 0.0028846   2.146 0.0946 .
## Residuals    292 0.3925 0.0013442                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(raw3, aes(x=factor(QUARTILE), y=abs.res.BD, fill=SPP)) +
  geom_boxplot()

A.CPD <- aov(abs.res.CPD ~ SPP*QUARTILE, data=raw3)
summary(A.CPD)
##               Df  Sum Sq   Mean Sq F value  Pr(>F)   
## SPP            1 0.00312 0.0031247   4.900 0.02764 * 
## QUARTILE       3 0.00786 0.0026201   4.108 0.00707 **
## SPP:QUARTILE   3 0.00713 0.0023775   3.728 0.01176 * 
## Residuals    292 0.18622 0.0006377                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(raw3, aes(x=factor(QUARTILE), y=abs.res.CPD, fill=SPP)) +
  geom_boxplot()

A.CPL <- aov(abs.res.CPL ~ SPP*QUARTILE, data=raw3)
summary(A.CPL)
##               Df  Sum Sq  Mean Sq F value   Pr(>F)    
## SPP            1 0.00000 0.000000   0.000 0.986836    
## QUARTILE       3 0.01640 0.005468   6.588 0.000254 ***
## SPP:QUARTILE   3 0.02033 0.006777   8.166 3.08e-05 ***
## Residuals    292 0.24236 0.000830                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(raw3, aes(x=factor(QUARTILE), y=abs.res.CPL, fill=SPP)) +
  geom_boxplot()

A.PreDL <- aov(abs.res.PreDL ~ SPP*QUARTILE, data=raw3)
summary(A.PreDL)
##               Df  Sum Sq   Mean Sq F value Pr(>F)  
## SPP            1 0.00006 0.0000590   0.145 0.7035  
## QUARTILE       3 0.00243 0.0008091   1.991 0.1155  
## SPP:QUARTILE   3 0.00392 0.0013082   3.218 0.0232 *
## Residuals    292 0.11869 0.0004065                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(raw3, aes(x=factor(QUARTILE), y=abs.res.PreDL, fill=SPP)) +
  geom_boxplot()

A.DbL <- aov(abs.res.DbL ~ SPP*QUARTILE, data=raw3)
summary(A.DbL)
##               Df Sum Sq  Mean Sq F value Pr(>F)
## SPP            1 0.0001 0.000068   0.037  0.847
## QUARTILE       3 0.0060 0.001997   1.093  0.352
## SPP:QUARTILE   3 0.0068 0.002277   1.246  0.293
## Residuals    292 0.5335 0.001827
ggplot(raw3, aes(x=factor(QUARTILE), y=abs.res.DbL, fill=SPP)) +
  geom_boxplot()

A.HL <- aov(abs.res.HL ~ SPP*QUARTILE, data=raw3)
summary(A.HL)
##               Df  Sum Sq  Mean Sq F value   Pr(>F)    
## SPP            1 0.00081 0.000812   0.861   0.3541    
## QUARTILE       3 0.02099 0.006995   7.421 8.33e-05 ***
## SPP:QUARTILE   3 0.01029 0.003432   3.640   0.0132 *  
## Residuals    292 0.27527 0.000943                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(raw3, aes(x=factor(QUARTILE), y=abs.res.HL, fill=SPP)) +
  geom_boxplot()

A.HD <- aov(abs.res.HD ~ SPP*QUARTILE, data=raw3)
summary(A.HD)
##               Df  Sum Sq   Mean Sq F value Pr(>F)
## SPP            1 0.00000 0.0000000   0.000  0.999
## QUARTILE       3 0.00443 0.0014757   1.522  0.209
## SPP:QUARTILE   3 0.00582 0.0019390   1.999  0.114
## Residuals    292 0.28319 0.0009698
A.HW <- aov(abs.res.HW ~ SPP*QUARTILE, data=raw3)
summary(A.HW)
##               Df  Sum Sq   Mean Sq F value  Pr(>F)   
## SPP            1 0.00213 0.0021307   2.861 0.09184 . 
## QUARTILE       3 0.00917 0.0030561   4.103 0.00712 **
## SPP:QUARTILE   3 0.00710 0.0023664   3.177 0.02448 * 
## Residuals    292 0.21750 0.0007449                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(raw3, aes(x=factor(QUARTILE), y=abs.res.HW, fill=SPP)) +
  geom_boxplot()

A.SnL <- aov(abs.res.SnL ~ SPP*QUARTILE, data=raw3)
summary(A.SnL)
##               Df  Sum Sq  Mean Sq F value   Pr(>F)    
## SPP            1 0.00009 0.000095   0.163   0.6867    
## QUARTILE       3 0.01743 0.005809   9.995 2.73e-06 ***
## SPP:QUARTILE   3 0.00494 0.001647   2.833   0.0386 *  
## Residuals    292 0.16972 0.000581                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
A.OL <- aov(abs.res.OL ~ SPP*QUARTILE, data=raw3)
summary(A.OL)
##               Df    Sum Sq   Mean Sq F value Pr(>F)  
## SPP            1 4.900e-33 4.915e-33   2.108 0.1476  
## QUARTILE       3 1.830e-32 6.103e-33   2.617 0.0512 .
## SPP:QUARTILE   3 5.800e-33 1.948e-33   0.835 0.4754  
## Residuals    292 6.809e-31 2.332e-33                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(raw3, aes(x=factor(QUARTILE), y=abs.res.OL, fill=SPP)) +
  geom_boxplot()

Basins
A1.D <- aov(abs.res.D ~ SPP*BASIN, data=raw3)
summary(A1.D)
##              Df Sum Sq Mean Sq F value  Pr(>F)   
## SPP           1   0.06  0.0635   0.402 0.52666   
## BASIN         6   3.12  0.5205   3.293 0.00377 **
## SPP:BASIN     3   0.31  0.1028   0.650 0.58344   
## Residuals   289  45.68  0.1581                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(raw3, aes(x=factor(BASIN), y=abs.res.D, fill=SPP)) +
  geom_boxplot()

A1.P1 <- aov(abs.res.P1 ~ SPP*BASIN, data=raw3)
summary(A1.P1)
##              Df Sum Sq Mean Sq F value Pr(>F)
## SPP           1   0.29  0.2878   1.528  0.217
## BASIN         6   0.97  0.1613   0.856  0.528
## SPP:BASIN     3   0.53  0.1751   0.930  0.427
## Residuals   289  54.43  0.1883
A1.P1.R <- aov(abs.res.P1.R ~ SPP*BASIN, data=raw3)
summary(A1.P1.R)
##              Df Sum Sq Mean Sq F value   Pr(>F)    
## SPP           1   1.80  1.7983  11.421 0.000826 ***
## BASIN         6   0.51  0.0845   0.537 0.780341    
## SPP:BASIN     3   0.15  0.0485   0.308 0.819718    
## Residuals   289  45.50  0.1575                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(raw3, aes(x=factor(BASIN), y=abs.res.P1.R, fill=SPP)) +
  geom_boxplot()

A1.LLSC <- aov(abs.res.LLSC ~ SPP*BASIN, data=raw3)
summary(A1.LLSC)
##              Df Sum Sq Mean Sq F value Pr(>F)  
## SPP           1   1.40  1.4013   2.999 0.0844 .
## BASIN         6   6.83  1.1376   2.435 0.0260 *
## SPP:BASIN     3   2.11  0.7026   1.504 0.2137  
## Residuals   289 135.02  0.4672                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(raw3, aes(x=factor(BASIN), y=abs.res.LLSC, fill=SPP)) +
  geom_boxplot()

A1.SBLL <- aov(abs.res.SBLL ~ SPP*BASIN, data=raw3)
summary(A1.SBLL)
##              Df Sum Sq Mean Sq F value Pr(>F)  
## SPP           1   0.65  0.6523   4.895 0.0277 *
## BASIN         6   1.07  0.1785   1.340 0.2393  
## SPP:BASIN     3   0.51  0.1716   1.288 0.2788  
## Residuals   289  38.51  0.1332                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(raw3, aes(x=factor(BASIN), y=abs.res.SBLL, fill=SPP)) +
  geom_boxplot()

A1.BD <- aov(abs.res.BD ~ SPP*BASIN, data=raw3)
summary(A1.BD)
##              Df Sum Sq  Mean Sq F value Pr(>F)  
## SPP           1 0.0000 0.000035   0.027 0.8701  
## BASIN         6 0.0190 0.003167   2.450 0.0251 *
## SPP:BASIN     3 0.0101 0.003367   2.605 0.0520 .
## Residuals   289 0.3735 0.001292                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(raw3, aes(x=factor(BASIN), y=abs.res.BD, fill=SPP)) +
  geom_boxplot()

A1.CPD <- aov(abs.res.CPD ~ SPP*BASIN, data=raw3)
summary(A1.CPD)
##              Df  Sum Sq   Mean Sq F value   Pr(>F)    
## SPP           1 0.00312 0.0031247   4.984 0.026343 *  
## BASIN         6 0.01576 0.0026273   4.191 0.000464 ***
## SPP:BASIN     3 0.00428 0.0014261   2.275 0.080070 .  
## Residuals   289 0.18117 0.0006269                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(raw3, aes(x=factor(BASIN), y=abs.res.CPD, fill=SPP)) +
  geom_boxplot()

A1.CPL <- aov(abs.res.CPL ~ SPP*BASIN, data=raw3)
summary(A1.CPL)
##              Df  Sum Sq  Mean Sq F value   Pr(>F)    
## SPP           1 0.00000 0.000000   0.000    0.987    
## BASIN         6 0.03228 0.005380   6.320 2.92e-06 ***
## SPP:BASIN     3 0.00078 0.000259   0.304    0.822    
## Residuals   289 0.24603 0.000851                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
A1.PreDL <- aov(abs.res.PreDL ~ SPP*BASIN, data=raw3)
summary(A1.PreDL)
##              Df  Sum Sq   Mean Sq F value Pr(>F)  
## SPP           1 0.00006 0.0000590   0.147 0.7020  
## BASIN         6 0.00466 0.0007773   1.932 0.0755 .
## SPP:BASIN     3 0.00412 0.0013741   3.416 0.0178 *
## Residuals   289 0.11626 0.0004023                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(raw3, aes(x=factor(BASIN), y=abs.res.PreDL, fill=SPP)) +
  geom_boxplot()

A1.DbL <- aov(abs.res.DbL ~ SPP*BASIN, data=raw3)
summary(A1.DbL)
##              Df Sum Sq  Mean Sq F value Pr(>F)
## SPP           1 0.0001 0.000068   0.037  0.847
## BASIN         6 0.0152 0.002539   1.397  0.216
## SPP:BASIN     3 0.0057 0.001914   1.053  0.370
## Residuals   289 0.5254 0.001818
ggplot(raw3, aes(x=factor(BASIN), y=abs.res.DbL, fill=SPP)) +
  geom_boxplot()

A1.HL <- aov(abs.res.HL ~ SPP*BASIN, data=raw3)
summary(A1.HL)
##              Df  Sum Sq  Mean Sq F value  Pr(>F)   
## SPP           1 0.00081 0.000812   0.827 0.36379   
## BASIN         6 0.02039 0.003398   3.463 0.00255 **
## SPP:BASIN     3 0.00256 0.000852   0.868 0.45782   
## Residuals   289 0.28360 0.000981                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(raw3, aes(x=factor(BASIN), y=abs.res.HL, fill=SPP)) +
  geom_boxplot()

A1.HD <- aov(abs.res.HD ~ SPP*BASIN, data=raw3)
summary(A1.HD)
##              Df  Sum Sq   Mean Sq F value Pr(>F)
## SPP           1 0.00000 0.0000000   0.000  0.999
## BASIN         6 0.00478 0.0007959   0.808  0.565
## SPP:BASIN     3 0.00382 0.0012743   1.293  0.277
## Residuals   289 0.28484 0.0009856
ggplot(raw3, aes(x=factor(BASIN), y=abs.res.HD, fill=SPP)) +
  geom_boxplot()

A1.HW <- aov(abs.res.HW ~ SPP*BASIN, data=raw3)
summary(A1.HW)
##              Df  Sum Sq   Mean Sq F value  Pr(>F)   
## SPP           1 0.00213 0.0021307   2.825 0.09387 . 
## BASIN         6 0.01505 0.0025085   3.326 0.00349 **
## SPP:BASIN     3 0.00076 0.0002544   0.337 0.79838   
## Residuals   289 0.21795 0.0007542                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(raw3, aes(x=factor(BASIN), y=abs.res.HW, fill=SPP)) +
  geom_boxplot()

A1.SnL <- aov(abs.res.SnL ~ SPP*BASIN, data=raw3)
summary(A1.SnL)
##              Df  Sum Sq  Mean Sq F value   Pr(>F)    
## SPP           1 0.00009 0.000095   0.162    0.688    
## BASIN         6 0.02054 0.003424   5.849 8.99e-06 ***
## SPP:BASIN     3 0.00238 0.000794   1.357    0.256    
## Residuals   289 0.16916 0.000585                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
A1.OL <- aov(abs.res.OL ~ SPP*BASIN, data=raw3)
summary(A1.OL)
##              Df    Sum Sq   Mean Sq F value Pr(>F)
## SPP           1 4.900e-33 4.915e-33   2.054  0.153
## BASIN         6 9.200e-33 1.535e-33   0.641  0.697
## SPP:BASIN     3 4.100e-33 1.358e-33   0.567  0.637
## Residuals   289 6.917e-31 2.394e-33
ggplot(raw3, aes(x=factor(BASIN), y=abs.res.OL, fill=SPP)) +
  geom_boxplot()

Watersheds
A2.D <- aov(abs.res.D ~ SPP*WATERSHED, data=raw3)
summary(A2.D)
##                Df Sum Sq Mean Sq F value Pr(>F)  
## SPP             1   0.06  0.0635   0.415 0.5198  
## WATERSHED      13   4.33  0.3331   2.178 0.0106 *
## SPP:WATERSHED   5   1.96  0.3922   2.564 0.0274 *
## Residuals     280  42.82  0.1529                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(raw3, aes(x=factor(WATERSHED), y=abs.res.D, fill=SPP)) +
  geom_boxplot()

A2.P1 <- aov(abs.res.P1 ~ SPP*WATERSHED, data=raw3)
summary(A2.P1)
##                Df Sum Sq Mean Sq F value Pr(>F)  
## SPP             1   0.29  0.2878   1.568 0.2116  
## WATERSHED      13   3.73  0.2868   1.562 0.0957 .
## SPP:WATERSHED   5   0.78  0.1569   0.855 0.5120  
## Residuals     280  51.41  0.1836                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
A2.P1.R <- aov(abs.res.P1.R ~ SPP*WATERSHED, data=raw3)
summary(A2.P1.R)
##                Df Sum Sq Mean Sq F value   Pr(>F)    
## SPP             1   1.80  1.7983  11.145 0.000957 ***
## WATERSHED      13   0.82  0.0629   0.390 0.972416    
## SPP:WATERSHED   5   0.16  0.0322   0.199 0.962521    
## Residuals     280  45.18  0.1614                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(raw3, aes(x=factor(WATERSHED), y=abs.res.P1.R, fill=SPP)) +
  geom_boxplot()

A2.LLSC <- aov(abs.res.LLSC ~ SPP*WATERSHED, data=raw3)
summary(A2.LLSC)
##                Df Sum Sq Mean Sq F value   Pr(>F)    
## SPP             1   1.40  1.4013   3.299   0.0704 .  
## WATERSHED      13  20.28  1.5596   3.672 2.15e-05 ***
## SPP:WATERSHED   5   4.75  0.9502   2.237   0.0509 .  
## Residuals     280 118.93  0.4248                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(raw3, aes(x=factor(WATERSHED), y=abs.res.LLSC, fill=SPP)) +
  geom_boxplot()

A2.SBLL <- aov(abs.res.SBLL ~ SPP*WATERSHED, data=raw3)
summary(A2.SBLL)
##                Df Sum Sq Mean Sq F value   Pr(>F)    
## SPP             1   0.65  0.6523   5.611   0.0185 *  
## WATERSHED      13   2.98  0.2289   1.969   0.0233 *  
## SPP:WATERSHED   5   4.57  0.9138   7.861 6.06e-07 ***
## Residuals     280  32.55  0.1162                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(raw3, aes(x=factor(WATERSHED), y=abs.res.SBLL, fill=SPP)) +
  geom_boxplot()

A2.BD <- aov(abs.res.BD ~ SPP*WATERSHED, data=raw3)
summary(A2.BD)
##                Df Sum Sq  Mean Sq F value  Pr(>F)   
## SPP             1 0.0000 0.000035   0.028 0.86766   
## WATERSHED      13 0.0427 0.003283   2.639 0.00171 **
## SPP:WATERSHED   5 0.0115 0.002309   1.856 0.10214   
## Residuals     280 0.3484 0.001244                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(raw3, aes(x=factor(WATERSHED), y=abs.res.BD, fill=SPP)) +
  geom_boxplot()

A2.CPD <- aov(abs.res.CPD ~ SPP*WATERSHED, data=raw3)
summary(A2.CPD)
##                Df  Sum Sq   Mean Sq F value Pr(>F)  
## SPP             1 0.00312 0.0031247   4.943 0.0270 *
## WATERSHED      13 0.01690 0.0012999   2.056 0.0169 *
## SPP:WATERSHED   5 0.00731 0.0014624   2.313 0.0441 *
## Residuals     280 0.17700 0.0006322                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(raw3, aes(x=factor(WATERSHED), y=abs.res.CPD, fill=SPP)) +
  geom_boxplot()

A2.CPL <- aov(abs.res.CPL ~ SPP*WATERSHED, data=raw3)
summary(A2.CPL)
##                Df  Sum Sq  Mean Sq F value   Pr(>F)    
## SPP             1 0.00000 0.000000   0.000   0.9866    
## WATERSHED      13 0.04566 0.003512   4.406 8.64e-07 ***
## SPP:WATERSHED   5 0.01021 0.002043   2.563   0.0275 *  
## Residuals     280 0.22322 0.000797                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
A2.PreDL <- aov(abs.res.PreDL ~ SPP*WATERSHED, data=raw3)
summary(A2.PreDL)
##                Df  Sum Sq   Mean Sq F value Pr(>F)  
## SPP             1 0.00006 0.0000590   0.146 0.7022  
## WATERSHED      13 0.00996 0.0007664   1.902 0.0297 *
## SPP:WATERSHED   5 0.00229 0.0004575   1.136 0.3416  
## Residuals     280 0.11279 0.0004028                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
A2.DbL <- aov(abs.res.DbL ~ SPP*WATERSHED, data=raw3)
summary(A2.DbL)
##                Df Sum Sq  Mean Sq F value   Pr(>F)    
## SPP             1 0.0001 0.000068   0.040 0.841516    
## WATERSHED      13 0.0348 0.002680   1.579 0.090441 .  
## SPP:WATERSHED   5 0.0363 0.007253   4.273 0.000923 ***
## Residuals     280 0.4752 0.001697                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(raw3, aes(x=factor(WATERSHED), y=abs.res.DbL, fill=SPP)) +
  geom_boxplot()

A2.HL <- aov(abs.res.HL ~ SPP*WATERSHED, data=raw3)
summary(A2.HL)
##                Df  Sum Sq  Mean Sq F value   Pr(>F)    
## SPP             1 0.00081 0.000812   0.896    0.345    
## WATERSHED      13 0.05036 0.003874   4.275 1.54e-06 ***
## SPP:WATERSHED   5 0.00247 0.000494   0.546    0.742    
## Residuals     280 0.25372 0.000906                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(raw3, aes(x=factor(WATERSHED), y=abs.res.HL, fill=SPP)) +
  geom_boxplot()

A2.HD <- aov(abs.res.HD ~ SPP*WATERSHED, data=raw3)
summary(A2.HD)
##                Df  Sum Sq   Mean Sq F value Pr(>F)
## SPP             1 0.00000 0.0000000   0.000  0.999
## WATERSHED      13 0.01725 0.0013271   1.371  0.173
## SPP:WATERSHED   5 0.00519 0.0010375   1.072  0.376
## Residuals     280 0.27100 0.0009678
ggplot(raw3, aes(x=factor(WATERSHED), y=abs.res.HD, fill=SPP)) +
  geom_boxplot()

A2.HW <- aov(abs.res.HW ~ SPP*WATERSHED, data=raw3)
summary(A2.HW)
##                Df  Sum Sq   Mean Sq F value Pr(>F)  
## SPP             1 0.00213 0.0021307   2.862 0.0918 .
## WATERSHED      13 0.02008 0.0015446   2.075 0.0157 *
## SPP:WATERSHED   5 0.00521 0.0010418   1.399 0.2246  
## Residuals     280 0.20848 0.0007446                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(raw3, aes(x=factor(WATERSHED), y=abs.res.HW, fill=SPP)) +
  geom_boxplot()

A2.SnL <- aov(abs.res.SnL ~ SPP*WATERSHED, data=raw3)
summary(A2.SnL)
##                Df  Sum Sq   Mean Sq F value   Pr(>F)    
## SPP             1 0.00009 0.0000948   0.180    0.672    
## WATERSHED      13 0.04027 0.0030976   5.890 1.23e-09 ***
## SPP:WATERSHED   5 0.00457 0.0009144   1.739    0.126    
## Residuals     280 0.14725 0.0005259                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
A2.OL <- aov(abs.res.OL ~ SPP*WATERSHED, data=raw3)
summary(A2.OL)
##                Df    Sum Sq   Mean Sq F value Pr(>F)
## SPP             1 4.900e-33 4.915e-33   2.037  0.155
## WATERSHED      13 2.900e-32 2.231e-33   0.925  0.528
## SPP:WATERSHED   5 2.000e-34 4.600e-35   0.019  1.000
## Residuals     280 6.758e-31 2.414e-33
ggplot(raw3, aes(x=factor(WATERSHED), y=abs.res.OL, fill=SPP)) +
  geom_boxplot()

Standardized

DON’T KNOW IF THIS IS USEFUL

The ANOVAs above focus on differences of particular traits as a factor of species and location. If we want to get an idea of variation in general as a factor of species and location, we can standardize the residuals (essentially unitless z-scores of residuals).

sd.res.D <- append(abs(sd.lat.D), abs(sd.form.D))
sd.res.P1 <- append(abs(sd.lat.P1), abs(sd.form.P1))
sd.res.P1.R <- append(abs(sd.lat.P1.R), abs(sd.form.P1.R))
sd.res.LLSC<- append(abs(sd.lat.LLSC), abs(sd.form.LLSC))
sd.res.SBLL<- append(abs(sd.lat.SBLL), abs(sd.form.SBLL))
sd.res.BD<- append(abs(sd.lat.BD), abs(sd.form.BD))
sd.res.CPD<- append(abs(sd.lat.CPD), abs(sd.form.CPD))
sd.res.CPL<- append(abs(sd.lat.CPL), abs(sd.form.CPL))
sd.res.PreDL <- append(abs(sd.lat.PreDL), abs(sd.form.PreDL))
sd.res.DbL <- append(abs(sd.lat.DbL), abs(sd.form.DbL))
sd.res.HL<- append(abs(sd.lat.HL), abs(sd.form.HL))
sd.res.HD<- append(abs(sd.lat.HD), abs(sd.form.HD))
sd.res.HW <- append(abs(sd.lat.HW), abs(sd.form.HW))
sd.res.SnL <- append(abs(sd.lat.SnL), abs(sd.form.SnL))
sd.res.OL <- append(abs(sd.lat.OL), abs(sd.form.OL))


raw4 <- cbind(raw3, sd.res.D, sd.res.P1, sd.res.P1.R, sd.res.LLSC, sd.res.SBLL, sd.res.BD, sd.res.CPD, sd.res.CPL, sd.res.PreDL, sd.res.DbL, sd.res.HL, sd.res.HD, sd.res.HW, sd.res.SnL, sd.res.OL)

raw5 <- cbind(raw4[1:14], stack(raw4[53:68])) 
## Warning in data.frame(..., check.names = FALSE): row names were found from a
## short variable and have been discarded
lat.raw5 <- raw5[raw5$SPP == "p.latipinna",]

form.raw5 <- raw5[raw5$SPP == "p.formosa",]

######ZONES#####

A3.lat <- aov(values~QUARTILE, data=lat.raw5)
summary(A3.lat)
##               Df Sum Sq Mean Sq F value Pr(>F)
## QUARTILE       3    0.6  0.2106    1.13  0.336
## Residuals   2140  398.9  0.1864
A3.form <- aov(values~QUARTILE, data=form.raw5)
summary(A3.form)
##               Df Sum Sq Mean Sq F value Pr(>F)  
## QUARTILE       3    1.9  0.6213   2.851 0.0361 *
## Residuals   2652  578.0  0.2180                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#between species

A3 <- aov(values~QUARTILE*SPP, data=raw5)
summary(A3)
##                Df Sum Sq Mean Sq F value Pr(>F)  
## QUARTILE        3    0.8  0.2626   1.288  0.277  
## SPP             1    0.1  0.0604   0.296  0.586  
## QUARTILE:SPP    3    1.7  0.5578   2.736  0.042 *
## Residuals    4792  976.9  0.2039                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(raw5, aes(x=factor(QUARTILE), y=values, fill=SPP)) +
  geom_boxplot()

######BASINS#####

A4.lat <- aov(values~BASIN, data=lat.raw5)
summary(A4.lat)
##               Df Sum Sq Mean Sq F value Pr(>F)
## BASIN          5    0.8  0.1597   0.856   0.51
## Residuals   2138  398.7  0.1865
A4.form <- aov(values~BASIN, data=form.raw5)
summary(A4.form)
##               Df Sum Sq Mean Sq F value Pr(>F)
## BASIN          4    0.6  0.1525   0.698  0.593
## Residuals   2651  579.3  0.2185
#between species

A4 <- aov(values~BASIN*SPP, data=raw5)
summary(A4)
##               Df Sum Sq Mean Sq F value Pr(>F)
## BASIN          6    0.6 0.09760   0.478  0.825
## SPP            1    0.0 0.03245   0.159  0.690
## BASIN:SPP      3    0.8 0.27201   1.332  0.262
## Residuals   4789  978.0 0.20422
ggplot(raw5, aes(x=factor(BASIN), y=values, fill=SPP)) +
  geom_boxplot()

#####WATERSHEDS#####
A5.lat <- aov(values~WATERSHED, data=lat.raw5)
summary(A5.lat)
##               Df Sum Sq Mean Sq F value Pr(>F)
## WATERSHED     11    2.7  0.2441   1.312  0.211
## Residuals   2132  396.8  0.1861
A5.form <- aov(values~WATERSHED, data=form.raw5)
summary(A5.form)
##               Df Sum Sq Mean Sq F value   Pr(>F)    
## WATERSHED      7    5.9  0.8383   3.867 0.000339 ***
## Residuals   2648  574.0  0.2168                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#between species

A5 <- aov(values~WATERSHED*SPP, data=raw5)
summary(A5)
##                 Df Sum Sq Mean Sq F value  Pr(>F)   
## WATERSHED       13    5.9  0.4574   2.252 0.00609 **
## SPP              1    0.2  0.1715   0.844 0.35818   
## WATERSHED:SPP    5    2.5  0.4924   2.424 0.03332 * 
## Residuals     4780  970.8  0.2031                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(raw5, aes(x=factor(WATERSHED), y=values, fill=SPP)) +
  geom_boxplot()

GLMMs

Will run mixed models with zones/basins/watersheds as random effect. This will account for any variation seen at these levels and show us if there are any consistent species differences. Can only do this with residuals.

Zones

library(lme4)
## Loading required package: Matrix
library(lmerTest)
## 
## Attaching package: 'lmerTest'
## The following object is masked from 'package:lme4':
## 
##     lmer
## The following object is masked from 'package:stats':
## 
##     step
MM.D <- glmer(abs.res.D ~ SPP + (1|QUARTILE), data=raw3)#originally had family=poisson, since this is count data, but because this was the residuals of count data, the values were non-integers and poisson only deals with integers. 
## Warning in glmer(abs.res.D ~ SPP + (1 | QUARTILE), data = raw3): calling
## glmer() with family=gaussian (identity link) as a shortcut to lmer() is
## deprecated; please call lmer() directly
## boundary (singular) fit: see help('isSingular')
MM.D.a <- anova(MM.D, test="Chisq")
## Warning in anova.merMod(MM.D, test = "Chisq"): additional arguments ignored:
## 'test'
summary(MM.D.a)
##       npar       Sum Sq           Mean Sq           F value      
##  Min.   :1   Min.   :0.06351   Min.   :0.06351   Min.   :0.3854  
##  1st Qu.:1   1st Qu.:0.06351   1st Qu.:0.06351   1st Qu.:0.3854  
##  Median :1   Median :0.06351   Median :0.06351   Median :0.3854  
##  Mean   :1   Mean   :0.06351   Mean   :0.06351   Mean   :0.3854  
##  3rd Qu.:1   3rd Qu.:0.06351   3rd Qu.:0.06351   3rd Qu.:0.3854  
##  Max.   :1   Max.   :0.06351   Max.   :0.06351   Max.   :0.3854
MM.P1 <- glmer(abs.res.P1 ~ SPP+ (1|QUARTILE), data=raw3)
## Warning in glmer(abs.res.P1 ~ SPP + (1 | QUARTILE), data = raw3): calling
## glmer() with family=gaussian (identity link) as a shortcut to lmer() is
## deprecated; please call lmer() directly
MM.P1.a <- anova(MM.P1, test="Chisq")
## Warning in anova.merMod(MM.P1, test = "Chisq"): additional arguments ignored:
## 'test'
summary(MM.P1.a)
##       npar       Sum Sq          Mean Sq          F value     
##  Min.   :1   Min.   :0.3631   Min.   :0.3631   Min.   :1.956  
##  1st Qu.:1   1st Qu.:0.3631   1st Qu.:0.3631   1st Qu.:1.956  
##  Median :1   Median :0.3631   Median :0.3631   Median :1.956  
##  Mean   :1   Mean   :0.3631   Mean   :0.3631   Mean   :1.956  
##  3rd Qu.:1   3rd Qu.:0.3631   3rd Qu.:0.3631   3rd Qu.:1.956  
##  Max.   :1   Max.   :0.3631   Max.   :0.3631   Max.   :1.956
MM.P1.R <- glmer(abs.res.P1.R ~ SPP+ (1|QUARTILE), data=raw3)
## Warning in glmer(abs.res.P1.R ~ SPP + (1 | QUARTILE), data = raw3): calling
## glmer() with family=gaussian (identity link) as a shortcut to lmer() is
## deprecated; please call lmer() directly
## boundary (singular) fit: see help('isSingular')
MM.P1.Ra <- anova(MM.P1.R, test="Chisq")
## Warning in anova.merMod(MM.P1.R, test = "Chisq"): additional arguments ignored:
## 'test'
summary(MM.P1.Ra)
##       npar       Sum Sq         Mean Sq         F value     
##  Min.   :1   Min.   :1.798   Min.   :1.798   Min.   :11.61  
##  1st Qu.:1   1st Qu.:1.798   1st Qu.:1.798   1st Qu.:11.61  
##  Median :1   Median :1.798   Median :1.798   Median :11.61  
##  Mean   :1   Mean   :1.798   Mean   :1.798   Mean   :11.61  
##  3rd Qu.:1   3rd Qu.:1.798   3rd Qu.:1.798   3rd Qu.:11.61  
##  Max.   :1   Max.   :1.798   Max.   :1.798   Max.   :11.61
MM.LLSC <- glmer(abs.res.LLSC ~ SPP+ (1|QUARTILE), data=raw3)
## Warning in glmer(abs.res.LLSC ~ SPP + (1 | QUARTILE), data = raw3): calling
## glmer() with family=gaussian (identity link) as a shortcut to lmer() is
## deprecated; please call lmer() directly
## boundary (singular) fit: see help('isSingular')
MM.LLSC.a <- anova(MM.LLSC, test="Chisq")
## Warning in anova.merMod(MM.LLSC, test = "Chisq"): additional arguments ignored:
## 'test'
summary(MM.LLSC.a)
##       npar       Sum Sq         Mean Sq         F value     
##  Min.   :1   Min.   :1.401   Min.   :1.401   Min.   :2.901  
##  1st Qu.:1   1st Qu.:1.401   1st Qu.:1.401   1st Qu.:2.901  
##  Median :1   Median :1.401   Median :1.401   Median :2.901  
##  Mean   :1   Mean   :1.401   Mean   :1.401   Mean   :2.901  
##  3rd Qu.:1   3rd Qu.:1.401   3rd Qu.:1.401   3rd Qu.:2.901  
##  Max.   :1   Max.   :1.401   Max.   :1.401   Max.   :2.901
MM.SBLL <- glmer(abs.res.SBLL ~ SPP+ (1|QUARTILE), data=raw3)
## Warning in glmer(abs.res.SBLL ~ SPP + (1 | QUARTILE), data = raw3): calling
## glmer() with family=gaussian (identity link) as a shortcut to lmer() is
## deprecated; please call lmer() directly
MM.SBLL.a <- anova(MM.SBLL, test="Chisq")
## Warning in anova.merMod(MM.SBLL, test = "Chisq"): additional arguments ignored:
## 'test'
summary(MM.SBLL.a)
##       npar       Sum Sq          Mean Sq          F value     
##  Min.   :1   Min.   :0.5775   Min.   :0.5775   Min.   :4.335  
##  1st Qu.:1   1st Qu.:0.5775   1st Qu.:0.5775   1st Qu.:4.335  
##  Median :1   Median :0.5775   Median :0.5775   Median :4.335  
##  Mean   :1   Mean   :0.5775   Mean   :0.5775   Mean   :4.335  
##  3rd Qu.:1   3rd Qu.:0.5775   3rd Qu.:0.5775   3rd Qu.:4.335  
##  Max.   :1   Max.   :0.5775   Max.   :0.5775   Max.   :4.335
MM.BD <- glmer(abs.res.BD ~ SPP+ (1|QUARTILE), data=raw3)
## Warning in glmer(abs.res.BD ~ SPP + (1 | QUARTILE), data = raw3): calling
## glmer() with family=gaussian (identity link) as a shortcut to lmer() is
## deprecated; please call lmer() directly
## boundary (singular) fit: see help('isSingular')
MM.BD.a <- anova(MM.BD, test="Chisq")
## Warning in anova.merMod(MM.BD, test = "Chisq"): additional arguments ignored:
## 'test'
summary(MM.BD.a)
##       npar       Sum Sq             Mean Sq             F value       
##  Min.   :1   Min.   :3.461e-05   Min.   :3.461e-05   Min.   :0.02562  
##  1st Qu.:1   1st Qu.:3.461e-05   1st Qu.:3.461e-05   1st Qu.:0.02562  
##  Median :1   Median :3.461e-05   Median :3.461e-05   Median :0.02562  
##  Mean   :1   Mean   :3.461e-05   Mean   :3.461e-05   Mean   :0.02562  
##  3rd Qu.:1   3rd Qu.:3.461e-05   3rd Qu.:3.461e-05   3rd Qu.:0.02562  
##  Max.   :1   Max.   :3.461e-05   Max.   :3.461e-05   Max.   :0.02562
MM.CPD <- glmer(abs.res.CPD ~ SPP+ (1|QUARTILE), data=raw3)
## Warning in glmer(abs.res.CPD ~ SPP + (1 | QUARTILE), data = raw3): calling
## glmer() with family=gaussian (identity link) as a shortcut to lmer() is
## deprecated; please call lmer() directly
MM.CPD.a <- anova(MM.CPD, test="Chisq")
## Warning in anova.merMod(MM.CPD, test = "Chisq"): additional arguments ignored:
## 'test'
summary(MM.CPD.a)
##       npar       Sum Sq            Mean Sq            F value     
##  Min.   :1   Min.   :0.001722   Min.   :0.001722   Min.   :2.627  
##  1st Qu.:1   1st Qu.:0.001722   1st Qu.:0.001722   1st Qu.:2.627  
##  Median :1   Median :0.001722   Median :0.001722   Median :2.627  
##  Mean   :1   Mean   :0.001722   Mean   :0.001722   Mean   :2.627  
##  3rd Qu.:1   3rd Qu.:0.001722   3rd Qu.:0.001722   3rd Qu.:2.627  
##  Max.   :1   Max.   :0.001722   Max.   :0.001722   Max.   :2.627
MM.CPL <- glmer(abs.res.CPL ~ SPP+ (1|QUARTILE), data=raw3)
## Warning in glmer(abs.res.CPL ~ SPP + (1 | QUARTILE), data = raw3): calling
## glmer() with family=gaussian (identity link) as a shortcut to lmer() is
## deprecated; please call lmer() directly
MM.CPL.a <- anova(MM.CPL, test="Chisq")
## Warning in anova.merMod(MM.CPL, test = "Chisq"): additional arguments ignored:
## 'test'
summary(MM.CPL.a)
##       npar       Sum Sq             Mean Sq             F value      
##  Min.   :1   Min.   :0.0004791   Min.   :0.0004791   Min.   :0.5381  
##  1st Qu.:1   1st Qu.:0.0004791   1st Qu.:0.0004791   1st Qu.:0.5381  
##  Median :1   Median :0.0004791   Median :0.0004791   Median :0.5381  
##  Mean   :1   Mean   :0.0004791   Mean   :0.0004791   Mean   :0.5381  
##  3rd Qu.:1   3rd Qu.:0.0004791   3rd Qu.:0.0004791   3rd Qu.:0.5381  
##  Max.   :1   Max.   :0.0004791   Max.   :0.0004791   Max.   :0.5381
MM.PreDL <- glmer(abs.res.PreDL ~ SPP+ (1|QUARTILE), data=raw3)
## Warning in glmer(abs.res.PreDL ~ SPP + (1 | QUARTILE), data = raw3): calling
## glmer() with family=gaussian (identity link) as a shortcut to lmer() is
## deprecated; please call lmer() directly
MM.PreDL.a <- anova(MM.PreDL, test="Chisq")
## Warning in anova.merMod(MM.PreDL, test = "Chisq"): additional arguments
## ignored: 'test'
summary(MM.PreDL.a)
##       npar       Sum Sq            Mean Sq            F value       
##  Min.   :1   Min.   :2.76e-05   Min.   :2.76e-05   Min.   :0.06634  
##  1st Qu.:1   1st Qu.:2.76e-05   1st Qu.:2.76e-05   1st Qu.:0.06634  
##  Median :1   Median :2.76e-05   Median :2.76e-05   Median :0.06634  
##  Mean   :1   Mean   :2.76e-05   Mean   :2.76e-05   Mean   :0.06634  
##  3rd Qu.:1   3rd Qu.:2.76e-05   3rd Qu.:2.76e-05   3rd Qu.:0.06634  
##  Max.   :1   Max.   :2.76e-05   Max.   :2.76e-05   Max.   :0.06634
MM.DbL <- glmer(abs.res.DbL ~ SPP+ (1|QUARTILE), data=raw3)
## Warning in glmer(abs.res.DbL ~ SPP + (1 | QUARTILE), data = raw3): calling
## glmer() with family=gaussian (identity link) as a shortcut to lmer() is
## deprecated; please call lmer() directly
MM.DbL.a <- anova(MM.DbL, test="Chisq")
## Warning in anova.merMod(MM.DbL, test = "Chisq"): additional arguments ignored:
## 'test'
summary(MM.DbL.a)
##       npar       Sum Sq             Mean Sq             F value       
##  Min.   :1   Min.   :4.269e-05   Min.   :4.269e-05   Min.   :0.02331  
##  1st Qu.:1   1st Qu.:4.269e-05   1st Qu.:4.269e-05   1st Qu.:0.02331  
##  Median :1   Median :4.269e-05   Median :4.269e-05   Median :0.02331  
##  Mean   :1   Mean   :4.269e-05   Mean   :4.269e-05   Mean   :0.02331  
##  3rd Qu.:1   3rd Qu.:4.269e-05   3rd Qu.:4.269e-05   3rd Qu.:0.02331  
##  Max.   :1   Max.   :4.269e-05   Max.   :4.269e-05   Max.   :0.02331
MM.HL <- glmer(abs.res.HL ~ SPP+ (1|QUARTILE), data=raw3)
## Warning in glmer(abs.res.HL ~ SPP + (1 | QUARTILE), data = raw3): calling
## glmer() with family=gaussian (identity link) as a shortcut to lmer() is
## deprecated; please call lmer() directly
MM.HL.a <- anova(MM.HL, test="Chisq")
## Warning in anova.merMod(MM.HL, test = "Chisq"): additional arguments ignored:
## 'test'
summary(MM.HL.a)
##       npar       Sum Sq            Mean Sq            F value     
##  Min.   :1   Min.   :0.001879   Min.   :0.001879   Min.   :1.941  
##  1st Qu.:1   1st Qu.:0.001879   1st Qu.:0.001879   1st Qu.:1.941  
##  Median :1   Median :0.001879   Median :0.001879   Median :1.941  
##  Mean   :1   Mean   :0.001879   Mean   :0.001879   Mean   :1.941  
##  3rd Qu.:1   3rd Qu.:0.001879   3rd Qu.:0.001879   3rd Qu.:1.941  
##  Max.   :1   Max.   :0.001879   Max.   :0.001879   Max.   :1.941
MM.HD <- glmer(abs.res.HD ~ SPP+ (1|QUARTILE), data=raw3)
## Warning in glmer(abs.res.HD ~ SPP + (1 | QUARTILE), data = raw3): calling
## glmer() with family=gaussian (identity link) as a shortcut to lmer() is
## deprecated; please call lmer() directly
MM.HD.a <- anova(MM.HD, test="Chisq")
## Warning in anova.merMod(MM.HD, test = "Chisq"): additional arguments ignored:
## 'test'
summary(MM.HD.a)
##       npar       Sum Sq             Mean Sq             F value        
##  Min.   :1   Min.   :1.701e-06   Min.   :1.701e-06   Min.   :0.001735  
##  1st Qu.:1   1st Qu.:1.701e-06   1st Qu.:1.701e-06   1st Qu.:0.001735  
##  Median :1   Median :1.701e-06   Median :1.701e-06   Median :0.001735  
##  Mean   :1   Mean   :1.701e-06   Mean   :1.701e-06   Mean   :0.001735  
##  3rd Qu.:1   3rd Qu.:1.701e-06   3rd Qu.:1.701e-06   3rd Qu.:0.001735  
##  Max.   :1   Max.   :1.701e-06   Max.   :1.701e-06   Max.   :0.001735
MM.HW <- glmer(abs.res.HW ~ SPP+ (1|QUARTILE), data=raw3)
## Warning in glmer(abs.res.HW ~ SPP + (1 | QUARTILE), data = raw3): calling
## glmer() with family=gaussian (identity link) as a shortcut to lmer() is
## deprecated; please call lmer() directly
MM.HW.a <- anova(MM.HW, test="Chisq")
## Warning in anova.merMod(MM.HW, test = "Chisq"): additional arguments ignored:
## 'test'
summary(MM.HW.a)
##       npar       Sum Sq            Mean Sq            F value     
##  Min.   :1   Min.   :0.002504   Min.   :0.002504   Min.   :3.287  
##  1st Qu.:1   1st Qu.:0.002504   1st Qu.:0.002504   1st Qu.:3.287  
##  Median :1   Median :0.002504   Median :0.002504   Median :3.287  
##  Mean   :1   Mean   :0.002504   Mean   :0.002504   Mean   :3.287  
##  3rd Qu.:1   3rd Qu.:0.002504   3rd Qu.:0.002504   3rd Qu.:3.287  
##  Max.   :1   Max.   :0.002504   Max.   :0.002504   Max.   :3.287
MM.SnL <- glmer(abs.res.SnL ~ SPP+ (1|QUARTILE), data=raw3)
## Warning in glmer(abs.res.SnL ~ SPP + (1 | QUARTILE), data = raw3): calling
## glmer() with family=gaussian (identity link) as a shortcut to lmer() is
## deprecated; please call lmer() directly
MM.SnL.a <- anova(MM.SnL, test="Chisq")
## Warning in anova.merMod(MM.SnL, test = "Chisq"): additional arguments ignored:
## 'test'
summary(MM.SnL.a)
##       npar       Sum Sq             Mean Sq             F value      
##  Min.   :1   Min.   :0.0005063   Min.   :0.0005063   Min.   :0.8551  
##  1st Qu.:1   1st Qu.:0.0005063   1st Qu.:0.0005063   1st Qu.:0.8551  
##  Median :1   Median :0.0005063   Median :0.0005063   Median :0.8551  
##  Mean   :1   Mean   :0.0005063   Mean   :0.0005063   Mean   :0.8551  
##  3rd Qu.:1   3rd Qu.:0.0005063   3rd Qu.:0.0005063   3rd Qu.:0.8551  
##  Max.   :1   Max.   :0.0005063   Max.   :0.0005063   Max.   :0.8551
MM.OL <- glmer(abs.res.OL ~ SPP+ (1|QUARTILE), data=raw3)
## Warning in glmer(abs.res.OL ~ SPP + (1 | QUARTILE), data = raw3): calling
## glmer() with family=gaussian (identity link) as a shortcut to lmer() is
## deprecated; please call lmer() directly
MM.OL.a <- anova(MM.OL, test="Chisq")
## Warning in anova.merMod(MM.OL, test = "Chisq"): additional arguments ignored:
## 'test'
summary(MM.OL.a)
##       npar       Sum Sq            Mean Sq            F value     
##  Min.   :1   Min.   :4.43e-33   Min.   :4.43e-33   Min.   :1.904  
##  1st Qu.:1   1st Qu.:4.43e-33   1st Qu.:4.43e-33   1st Qu.:1.904  
##  Median :1   Median :4.43e-33   Median :4.43e-33   Median :1.904  
##  Mean   :1   Mean   :4.43e-33   Mean   :4.43e-33   Mean   :1.904  
##  3rd Qu.:1   3rd Qu.:4.43e-33   3rd Qu.:4.43e-33   3rd Qu.:1.904  
##  Max.   :1   Max.   :4.43e-33   Max.   :4.43e-33   Max.   :1.904

Watershed nested in Basin

MM1.D <- glmer(abs.res.D ~ SPP + (1|BASIN/WATERSHED), data=raw3)
## Warning in glmer(abs.res.D ~ SPP + (1 | BASIN/WATERSHED), data = raw3): calling
## glmer() with family=gaussian (identity link) as a shortcut to lmer() is
## deprecated; please call lmer() directly
MM1.D.a <- anova(MM1.D, test="Chisq")
## Warning in anova.merMod(MM1.D, test = "Chisq"): additional arguments ignored:
## 'test'
summary(MM1.D.a)
##       npar       Sum Sq           Mean Sq           F value      
##  Min.   :1   Min.   :0.01821   Min.   :0.01821   Min.   :0.1157  
##  1st Qu.:1   1st Qu.:0.01821   1st Qu.:0.01821   1st Qu.:0.1157  
##  Median :1   Median :0.01821   Median :0.01821   Median :0.1157  
##  Mean   :1   Mean   :0.01821   Mean   :0.01821   Mean   :0.1157  
##  3rd Qu.:1   3rd Qu.:0.01821   3rd Qu.:0.01821   3rd Qu.:0.1157  
##  Max.   :1   Max.   :0.01821   Max.   :0.01821   Max.   :0.1157
MM1.P1 <- glmer(abs.res.P1 ~ SPP+ (1|BASIN/WATERSHED), data=raw3)
## Warning in glmer(abs.res.P1 ~ SPP + (1 | BASIN/WATERSHED), data = raw3):
## calling glmer() with family=gaussian (identity link) as a shortcut to lmer() is
## deprecated; please call lmer() directly
## boundary (singular) fit: see help('isSingular')
MM1.P1.a <- anova(MM1.P1, test="Chisq")
## Warning in anova.merMod(MM1.P1, test = "Chisq"): additional arguments ignored:
## 'test'
summary(MM1.P1.a)
##       npar       Sum Sq          Mean Sq          F value     
##  Min.   :1   Min.   :0.2476   Min.   :0.2476   Min.   :1.363  
##  1st Qu.:1   1st Qu.:0.2476   1st Qu.:0.2476   1st Qu.:1.363  
##  Median :1   Median :0.2476   Median :0.2476   Median :1.363  
##  Mean   :1   Mean   :0.2476   Mean   :0.2476   Mean   :1.363  
##  3rd Qu.:1   3rd Qu.:0.2476   3rd Qu.:0.2476   3rd Qu.:1.363  
##  Max.   :1   Max.   :0.2476   Max.   :0.2476   Max.   :1.363
MM1.P1.R <- glmer(abs.res.P1.R ~ SPP+ (1|BASIN/WATERSHED), data=raw3)
## Warning in glmer(abs.res.P1.R ~ SPP + (1 | BASIN/WATERSHED), data = raw3):
## calling glmer() with family=gaussian (identity link) as a shortcut to lmer() is
## deprecated; please call lmer() directly
## boundary (singular) fit: see help('isSingular')
MM1.P1.Ra <- anova(MM1.P1.R, test="Chisq")
## Warning in anova.merMod(MM1.P1.R, test = "Chisq"): additional arguments
## ignored: 'test'
summary(MM1.P1.Ra)
##       npar       Sum Sq         Mean Sq         F value     
##  Min.   :1   Min.   :1.798   Min.   :1.798   Min.   :11.61  
##  1st Qu.:1   1st Qu.:1.798   1st Qu.:1.798   1st Qu.:11.61  
##  Median :1   Median :1.798   Median :1.798   Median :11.61  
##  Mean   :1   Mean   :1.798   Mean   :1.798   Mean   :11.61  
##  3rd Qu.:1   3rd Qu.:1.798   3rd Qu.:1.798   3rd Qu.:11.61  
##  Max.   :1   Max.   :1.798   Max.   :1.798   Max.   :11.61
MM1.LLSC <- glmer(abs.res.LLSC ~ SPP+ (1|BASIN/WATERSHED), data=raw3)
## Warning in glmer(abs.res.LLSC ~ SPP + (1 | BASIN/WATERSHED), data = raw3):
## calling glmer() with family=gaussian (identity link) as a shortcut to lmer() is
## deprecated; please call lmer() directly
## boundary (singular) fit: see help('isSingular')
MM1.LLSC.a <- anova(MM1.LLSC, test="Chisq")
## Warning in anova.merMod(MM1.LLSC, test = "Chisq"): additional arguments
## ignored: 'test'
summary(MM1.LLSC.a)
##       npar       Sum Sq          Mean Sq          F value 
##  Min.   :1   Min.   :0.8627   Min.   :0.8627   Min.   :2  
##  1st Qu.:1   1st Qu.:0.8627   1st Qu.:0.8627   1st Qu.:2  
##  Median :1   Median :0.8627   Median :0.8627   Median :2  
##  Mean   :1   Mean   :0.8627   Mean   :0.8627   Mean   :2  
##  3rd Qu.:1   3rd Qu.:0.8627   3rd Qu.:0.8627   3rd Qu.:2  
##  Max.   :1   Max.   :0.8627   Max.   :0.8627   Max.   :2
MM1.SBLL <- glmer(abs.res.SBLL ~ SPP+ (1|BASIN/WATERSHED), data=raw3)
## Warning in glmer(abs.res.SBLL ~ SPP + (1 | BASIN/WATERSHED), data = raw3):
## calling glmer() with family=gaussian (identity link) as a shortcut to lmer() is
## deprecated; please call lmer() directly
## boundary (singular) fit: see help('isSingular')
MM1.SBLL.a <- anova(MM1.SBLL, test="Chisq")
## Warning in anova.merMod(MM1.SBLL, test = "Chisq"): additional arguments
## ignored: 'test'
summary(MM1.SBLL.a)
##       npar       Sum Sq          Mean Sq          F value     
##  Min.   :1   Min.   :0.3889   Min.   :0.3889   Min.   :2.989  
##  1st Qu.:1   1st Qu.:0.3889   1st Qu.:0.3889   1st Qu.:2.989  
##  Median :1   Median :0.3889   Median :0.3889   Median :2.989  
##  Mean   :1   Mean   :0.3889   Mean   :0.3889   Mean   :2.989  
##  3rd Qu.:1   3rd Qu.:0.3889   3rd Qu.:0.3889   3rd Qu.:2.989  
##  Max.   :1   Max.   :0.3889   Max.   :0.3889   Max.   :2.989
MM1.BD <- glmer(abs.res.BD ~ SPP+ (1|BASIN/WATERSHED), data=raw3)
## Warning in glmer(abs.res.BD ~ SPP + (1 | BASIN/WATERSHED), data = raw3):
## calling glmer() with family=gaussian (identity link) as a shortcut to lmer() is
## deprecated; please call lmer() directly
MM1.BD.a <- anova(MM1.BD, test="Chisq")
## Warning in anova.merMod(MM1.BD, test = "Chisq"): additional arguments ignored:
## 'test'
summary(MM1.BD.a)
##       npar       Sum Sq             Mean Sq             F value      
##  Min.   :1   Min.   :0.0009062   Min.   :0.0009062   Min.   :0.7214  
##  1st Qu.:1   1st Qu.:0.0009062   1st Qu.:0.0009062   1st Qu.:0.7214  
##  Median :1   Median :0.0009062   Median :0.0009062   Median :0.7214  
##  Mean   :1   Mean   :0.0009062   Mean   :0.0009062   Mean   :0.7214  
##  3rd Qu.:1   3rd Qu.:0.0009062   3rd Qu.:0.0009062   3rd Qu.:0.7214  
##  Max.   :1   Max.   :0.0009062   Max.   :0.0009062   Max.   :0.7214
MM1.CPD <- glmer(abs.res.CPD ~ SPP+ (1|BASIN/WATERSHED), data=raw3)
## Warning in glmer(abs.res.CPD ~ SPP + (1 | BASIN/WATERSHED), data = raw3):
## calling glmer() with family=gaussian (identity link) as a shortcut to lmer() is
## deprecated; please call lmer() directly
## boundary (singular) fit: see help('isSingular')
MM1.CPD.a <- anova(MM1.CPD, test="Chisq")
## Warning in anova.merMod(MM1.CPD, test = "Chisq"): additional arguments ignored:
## 'test'
summary(MM1.CPD.a)
##       npar       Sum Sq            Mean Sq            F value    
##  Min.   :1   Min.   :0.001731   Min.   :0.001731   Min.   :2.71  
##  1st Qu.:1   1st Qu.:0.001731   1st Qu.:0.001731   1st Qu.:2.71  
##  Median :1   Median :0.001731   Median :0.001731   Median :2.71  
##  Mean   :1   Mean   :0.001731   Mean   :0.001731   Mean   :2.71  
##  3rd Qu.:1   3rd Qu.:0.001731   3rd Qu.:0.001731   3rd Qu.:2.71  
##  Max.   :1   Max.   :0.001731   Max.   :0.001731   Max.   :2.71
MM1.CPL <- glmer(abs.res.CPL ~ SPP+ (1|BASIN/WATERSHED), data=raw3)
## Warning in glmer(abs.res.CPL ~ SPP + (1 | BASIN/WATERSHED), data = raw3):
## calling glmer() with family=gaussian (identity link) as a shortcut to lmer() is
## deprecated; please call lmer() directly
MM1.CPL.a <- anova(MM1.CPL, test="Chisq")
## Warning in anova.merMod(MM1.CPL, test = "Chisq"): additional arguments ignored:
## 'test'
summary(MM1.CPL.a)
##       npar       Sum Sq             Mean Sq             F value      
##  Min.   :1   Min.   :0.0002359   Min.   :0.0002359   Min.   :0.2876  
##  1st Qu.:1   1st Qu.:0.0002359   1st Qu.:0.0002359   1st Qu.:0.2876  
##  Median :1   Median :0.0002359   Median :0.0002359   Median :0.2876  
##  Mean   :1   Mean   :0.0002359   Mean   :0.0002359   Mean   :0.2876  
##  3rd Qu.:1   3rd Qu.:0.0002359   3rd Qu.:0.0002359   3rd Qu.:0.2876  
##  Max.   :1   Max.   :0.0002359   Max.   :0.0002359   Max.   :0.2876
MM1.PreDL <- glmer(abs.res.PreDL ~ SPP+ (1|BASIN/WATERSHED), data=raw3)
## Warning in glmer(abs.res.PreDL ~ SPP + (1 | BASIN/WATERSHED), data = raw3):
## calling glmer() with family=gaussian (identity link) as a shortcut to lmer() is
## deprecated; please call lmer() directly
MM1.PreDL.a <- anova(MM1.PreDL, test="Chisq")
## Warning in anova.merMod(MM1.PreDL, test = "Chisq"): additional arguments
## ignored: 'test'
summary(MM1.PreDL.a)
##       npar       Sum Sq             Mean Sq             F value     
##  Min.   :1   Min.   :0.0004071   Min.   :0.0004071   Min.   :1.007  
##  1st Qu.:1   1st Qu.:0.0004071   1st Qu.:0.0004071   1st Qu.:1.007  
##  Median :1   Median :0.0004071   Median :0.0004071   Median :1.007  
##  Mean   :1   Mean   :0.0004071   Mean   :0.0004071   Mean   :1.007  
##  3rd Qu.:1   3rd Qu.:0.0004071   3rd Qu.:0.0004071   3rd Qu.:1.007  
##  Max.   :1   Max.   :0.0004071   Max.   :0.0004071   Max.   :1.007
MM1.DbL <- glmer(abs.res.DbL ~ SPP+ (1|BASIN/WATERSHED), data=raw3)
## Warning in glmer(abs.res.DbL ~ SPP + (1 | BASIN/WATERSHED), data = raw3):
## calling glmer() with family=gaussian (identity link) as a shortcut to lmer() is
## deprecated; please call lmer() directly
## boundary (singular) fit: see help('isSingular')
MM1.DbL.a <- anova(MM1.DbL, test="Chisq")
## Warning in anova.merMod(MM1.DbL, test = "Chisq"): additional arguments ignored:
## 'test'
summary(MM1.DbL.a)
##       npar       Sum Sq             Mean Sq             F value      
##  Min.   :1   Min.   :0.0003223   Min.   :0.0003223   Min.   :0.1812  
##  1st Qu.:1   1st Qu.:0.0003223   1st Qu.:0.0003223   1st Qu.:0.1812  
##  Median :1   Median :0.0003223   Median :0.0003223   Median :0.1812  
##  Mean   :1   Mean   :0.0003223   Mean   :0.0003223   Mean   :0.1812  
##  3rd Qu.:1   3rd Qu.:0.0003223   3rd Qu.:0.0003223   3rd Qu.:0.1812  
##  Max.   :1   Max.   :0.0003223   Max.   :0.0003223   Max.   :0.1812
MM1.HL <- glmer(abs.res.HL ~ SPP+ (1|BASIN/WATERSHED), data=raw3)
## Warning in glmer(abs.res.HL ~ SPP + (1 | BASIN/WATERSHED), data = raw3):
## calling glmer() with family=gaussian (identity link) as a shortcut to lmer() is
## deprecated; please call lmer() directly
## boundary (singular) fit: see help('isSingular')
MM1.HL.a <- anova(MM1.HL, test="Chisq")
## Warning in anova.merMod(MM1.HL, test = "Chisq"): additional arguments ignored:
## 'test'
summary(MM1.HL.a)
##       npar       Sum Sq             Mean Sq             F value       
##  Min.   :1   Min.   :3.697e-05   Min.   :3.697e-05   Min.   :0.04111  
##  1st Qu.:1   1st Qu.:3.697e-05   1st Qu.:3.697e-05   1st Qu.:0.04111  
##  Median :1   Median :3.697e-05   Median :3.697e-05   Median :0.04111  
##  Mean   :1   Mean   :3.697e-05   Mean   :3.697e-05   Mean   :0.04111  
##  3rd Qu.:1   3rd Qu.:3.697e-05   3rd Qu.:3.697e-05   3rd Qu.:0.04111  
##  Max.   :1   Max.   :3.697e-05   Max.   :3.697e-05   Max.   :0.04111
MM1.HD <- glmer(abs.res.HD ~ SPP+ (1|BASIN/WATERSHED), data=raw3)
## Warning in glmer(abs.res.HD ~ SPP + (1 | BASIN/WATERSHED), data = raw3):
## calling glmer() with family=gaussian (identity link) as a shortcut to lmer() is
## deprecated; please call lmer() directly
## boundary (singular) fit: see help('isSingular')
MM1.HD.a <- anova(MM1.HD, test="Chisq")
## Warning in anova.merMod(MM1.HD, test = "Chisq"): additional arguments ignored:
## 'test'
summary(MM1.HD.a)
##       npar       Sum Sq             Mean Sq             F value        
##  Min.   :1   Min.   :9.321e-06   Min.   :9.321e-06   Min.   :0.009664  
##  1st Qu.:1   1st Qu.:9.321e-06   1st Qu.:9.321e-06   1st Qu.:0.009664  
##  Median :1   Median :9.321e-06   Median :9.321e-06   Median :0.009664  
##  Mean   :1   Mean   :9.321e-06   Mean   :9.321e-06   Mean   :0.009664  
##  3rd Qu.:1   3rd Qu.:9.321e-06   3rd Qu.:9.321e-06   3rd Qu.:0.009664  
##  Max.   :1   Max.   :9.321e-06   Max.   :9.321e-06   Max.   :0.009664
MM1.HW <- glmer(abs.res.HW ~ SPP+ (1|BASIN/WATERSHED), data=raw3)
## Warning in glmer(abs.res.HW ~ SPP + (1 | BASIN/WATERSHED), data = raw3):
## calling glmer() with family=gaussian (identity link) as a shortcut to lmer() is
## deprecated; please call lmer() directly
MM1.HW.a <- anova(MM1.HW, test="Chisq")
## Warning in anova.merMod(MM1.HW, test = "Chisq"): additional arguments ignored:
## 'test'
summary(MM1.HW.a)
##       npar       Sum Sq            Mean Sq            F value     
##  Min.   :1   Min.   :0.004251   Min.   :0.004251   Min.   :5.681  
##  1st Qu.:1   1st Qu.:0.004251   1st Qu.:0.004251   1st Qu.:5.681  
##  Median :1   Median :0.004251   Median :0.004251   Median :5.681  
##  Mean   :1   Mean   :0.004251   Mean   :0.004251   Mean   :5.681  
##  3rd Qu.:1   3rd Qu.:0.004251   3rd Qu.:0.004251   3rd Qu.:5.681  
##  Max.   :1   Max.   :0.004251   Max.   :0.004251   Max.   :5.681
MM1.SnL <- glmer(abs.res.SnL ~ SPP+ (1|BASIN/WATERSHED), data=raw3)
## Warning in glmer(abs.res.SnL ~ SPP + (1 | BASIN/WATERSHED), data = raw3):
## calling glmer() with family=gaussian (identity link) as a shortcut to lmer() is
## deprecated; please call lmer() directly
MM1.SnL.a <- anova(MM1.SnL, test="Chisq")
## Warning in anova.merMod(MM1.SnL, test = "Chisq"): additional arguments ignored:
## 'test'
summary(MM1.SnL.a)
##       npar       Sum Sq             Mean Sq             F value      
##  Min.   :1   Min.   :0.0003137   Min.   :0.0003137   Min.   :0.5899  
##  1st Qu.:1   1st Qu.:0.0003137   1st Qu.:0.0003137   1st Qu.:0.5899  
##  Median :1   Median :0.0003137   Median :0.0003137   Median :0.5899  
##  Mean   :1   Mean   :0.0003137   Mean   :0.0003137   Mean   :0.5899  
##  3rd Qu.:1   3rd Qu.:0.0003137   3rd Qu.:0.0003137   3rd Qu.:0.5899  
##  Max.   :1   Max.   :0.0003137   Max.   :0.0003137   Max.   :0.5899
MM1.OL <- glmer(abs.res.OL ~ SPP+ (1|BASIN/WATERSHED), data=raw3)
## Warning in glmer(abs.res.OL ~ SPP + (1 | BASIN/WATERSHED), data = raw3):
## calling glmer() with family=gaussian (identity link) as a shortcut to lmer() is
## deprecated; please call lmer() directly
MM1.OL.a <- anova(MM1.OL, test="Chisq")
## Warning in anova.merMod(MM1.OL, test = "Chisq"): additional arguments ignored:
## 'test'
summary(MM1.OL.a)
##       npar       Sum Sq             Mean Sq             F value    
##  Min.   :1   Min.   :3.795e-33   Min.   :3.795e-33   Min.   :1.62  
##  1st Qu.:1   1st Qu.:3.795e-33   1st Qu.:3.795e-33   1st Qu.:1.62  
##  Median :1   Median :3.795e-33   Median :3.795e-33   Median :1.62  
##  Mean   :1   Mean   :3.795e-33   Mean   :3.795e-33   Mean   :1.62  
##  3rd Qu.:1   3rd Qu.:3.795e-33   3rd Qu.:3.795e-33   3rd Qu.:1.62  
##  Max.   :1   Max.   :3.795e-33   Max.   :3.795e-33   Max.   :1.62

Levene’s w/ Basin?

Not sure if this is correct, but might try Levene’s test with zone/basin/watershed as an additional independent factor? This is for the traits that did NOT vary with body length.

Zones

library(car)
## Loading required package: carData
## 
## Attaching package: 'car'
## The following object is masked from 'package:dplyr':
## 
##     recode
(LT2_P2L <- leveneTest(P2.L~SPP*QUARTILE, data=raw3)) #gives nothing since it's all the same value
## Levene's Test for Homogeneity of Variance (center = median)
##        Df F value Pr(>F)
## group   7     NaN    NaN
##       292
(LT2_P2R <- leveneTest(P2.R~SPP*QUARTILE, data=raw3)) #same as above
## Levene's Test for Homogeneity of Variance (center = median)
##        Df F value Pr(>F)
## group   7     NaN    NaN
##       292
(LT2_A <- leveneTest(A~SPP*QUARTILE, data=raw3)) 
## Levene's Test for Homogeneity of Variance (center = median)
##        Df F value Pr(>F)
## group   7  1.0512 0.3954
##       292
(LT2_SALL <- leveneTest(SALL~SPP*QUARTILE, data=raw3))
## Levene's Test for Homogeneity of Variance (center = median)
##        Df F value    Pr(>F)    
## group   7  10.093 2.613e-11 ***
##       292                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(LT2_SBLL <- leveneTest(SBLL~SPP*QUARTILE, data=raw3))
## Levene's Test for Homogeneity of Variance (center = median)
##        Df F value Pr(>F)
## group   7  1.1533 0.3299
##       292
(LT2_SBDF <- leveneTest(SBDF~SPP*QUARTILE, data=raw3))
## Levene's Test for Homogeneity of Variance (center = median)
##        Df F value  Pr(>F)  
## group   7  2.0714 0.04655 *
##       292                  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(LT2_FLA <- leveneTest(FLA~SPP*QUARTILE, data=raw3))
## Levene's Test for Homogeneity of Variance (center = median)
##        Df F value   Pr(>F)   
## group   7  3.5457 0.001129 **
##       292                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Basins

(LT2_P2L <- leveneTest(P2.L~SPP*BASIN, data=raw3)) #gives nothing since it's all the same value
## Levene's Test for Homogeneity of Variance (center = median)
##        Df F value Pr(>F)
## group  10     NaN    NaN
##       289
(LT2_P2R <- leveneTest(P2.R~SPP*BASIN, data=raw3)) #same as above
## Levene's Test for Homogeneity of Variance (center = median)
##        Df F value Pr(>F)
## group  10     NaN    NaN
##       289
(LT2_A <- leveneTest(A~SPP*BASIN, data=raw3)) 
## Levene's Test for Homogeneity of Variance (center = median)
##        Df F value   Pr(>F)   
## group  10  2.7914 0.002593 **
##       289                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(LT2_SALL <- leveneTest(SALL~SPP*BASIN, data=raw3))
## Levene's Test for Homogeneity of Variance (center = median)
##        Df F value    Pr(>F)    
## group  10  10.224 9.633e-15 ***
##       289                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(LT2_SBLL <- leveneTest(SBLL~SPP*BASIN, data=raw3))
## Levene's Test for Homogeneity of Variance (center = median)
##        Df F value Pr(>F)
## group  10   1.467 0.1511
##       289
(LT2_SBDF <- leveneTest(SBDF~SPP*BASIN, data=raw3))
## Levene's Test for Homogeneity of Variance (center = median)
##        Df F value    Pr(>F)    
## group  10  3.3639 0.0003629 ***
##       289                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(LT2_FLA <- leveneTest(FLA~SPP*BASIN, data=raw3))
## Levene's Test for Homogeneity of Variance (center = median)
##        Df F value Pr(>F)
## group  10  1.4055  0.177
##       289

Watersheds

(LT2_P2L <- leveneTest(P2.L~SPP*WATERSHED, data=raw3)) #gives nothing since it's all the same value
## Levene's Test for Homogeneity of Variance (center = median)
##        Df F value Pr(>F)
## group  19     NaN    NaN
##       280
(LT2_P2R <- leveneTest(P2.R~SPP*WATERSHED, data=raw3)) #same as above
## Levene's Test for Homogeneity of Variance (center = median)
##        Df F value Pr(>F)
## group  19     NaN    NaN
##       280
(LT2_A <- leveneTest(A~SPP*WATERSHED, data=raw3)) 
## Levene's Test for Homogeneity of Variance (center = median)
##        Df F value  Pr(>F)  
## group  19  1.4755 0.09315 .
##       280                  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(LT2_SALL <- leveneTest(SALL~SPP*WATERSHED, data=raw3))
## Levene's Test for Homogeneity of Variance (center = median)
##        Df F value    Pr(>F)    
## group  19  4.7794 1.266e-09 ***
##       280                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(LT2_SBLL <- leveneTest(SBLL~SPP*WATERSHED, data=raw3))
## Levene's Test for Homogeneity of Variance (center = median)
##        Df F value   Pr(>F)   
## group  19  2.0999 0.005256 **
##       280                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(LT2_SBDF <- leveneTest(SBDF~SPP*WATERSHED, data=raw3))
## Levene's Test for Homogeneity of Variance (center = median)
##        Df F value   Pr(>F)   
## group  19  2.0915 0.005484 **
##       280                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(LT2_FLA <- leveneTest(FLA~SPP*WATERSHED, data=raw3))
## Levene's Test for Homogeneity of Variance (center = median)
##        Df F value  Pr(>F)  
## group  19  1.8711 0.01617 *
##       280                  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

ICCs

I’m hoping I can do this, but thought another interesting way of testing this would be to calculate and intraclass correlation coefficient–so looking at between-group variance compared to total variance, to see if variation is driven more from within or between group (if there is any at all…). I know lots of examples specify repeated measures, but I think the function below lets me specify that I only have one measurement per subject. I’m going to do this with raw data below, but will also repeat it with PCA scores in the PCA section, so that things are standardized for length. Since I’m interested in variation across populations, I think I would perform this within each sex; I am not sure how I would test this between sexes AND populations for each trait. Maybe I could then compare the ICC scores?

library(psych)

#ICC_result_twoway_explicit <- ICC(data = data\(value, id = data\)composite_id, grouping = data$population, model = “twoway”, type = “agreement”, unit = “single”, r0 = 1)

(ICC_L.D <- ICC(lat3))